{"thread":{"id":"42612","subject":"[PATCH] do not loop around deref_tag()","startedAt":"2016-06-16T06:55:52Z","lastAt":"2016-06-16T06:55:52Z","messageCount":2,"participants":["Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"289248","messageId":"xmqqfusf8qh4.fsf@gitster.mtv.corp.google.com","threadId":"42612","inReplyTo":null,"subject":"[PATCH] do not loop around deref_tag()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-14T20:28:39Z","receivedAt":"2016-06-16T06:55:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"These callers appear to expect that deref_tag() is to peel one layer\nof a tag, but the function does not work that way; it has its own\nloop to unwrap tags until an object that is not a tag appears.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/blame.c | 6 ++----\n line-log.c      | 3 +--\n 2 files changed, 3 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 21f42b0..7417edf 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -2425,8 +2425,7 @@ static struct commit *find_single_final(struct rev_info *revs,\n \t\tstruct object *obj = revs->pending.objects[i].item;\n \t\tif (obj->flags & UNINTERESTING)\n \t\t\tcontinue;\n-\t\twhile (obj->type == OBJ_TAG)\n-\t\t\tobj = deref_tag(obj, NULL, 0);\n+\t\tobj = deref_tag(obj, NULL, 0);\n \t\tif (obj->type != OBJ_COMMIT)\n \t\t\tdie(\"Non commit %s?\", revs->pending.objects[i].name);\n \t\tif (found)\n@@ -2461,8 +2460,7 @@ static char *prepare_initial(struct scoreboard *sb)\n \t\tstruct object *obj = revs->pending.objects[i].item;\n \t\tif (!(obj->flags & UNINTERESTING))\n \t\t\tcontinue;\n-\t\twhile (obj->type == OBJ_TAG)\n-\t\t\tobj = deref_tag(obj, NULL, 0);\n+\t\tobj = deref_tag(obj, NULL, 0);\n \t\tif (obj->type != OBJ_COMMIT)\n \t\t\tdie(\"Non commit %s?\", revs->pending.objects[i].name);\n \t\tif (sb->final)\ndiff --git a/line-log.c b/line-log.c\nindex bbe31ed..1fbbe4f 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -480,8 +480,7 @@ static struct commit *check_single_commit(struct rev_info *revs)\n \t\tstruct object *obj = revs->pending.objects[i].item;\n \t\tif (obj->flags & UNINTERESTING)\n \t\t\tcontinue;\n-\t\twhile (obj->type == OBJ_TAG)\n-\t\t\tobj = deref_tag(obj, NULL, 0);\n+\t\tobj = deref_tag(obj, NULL, 0);\n \t\tif (obj->type != OBJ_COMMIT)\n \t\t\tdie(\"Non commit %s?\", revs->pending.objects[i].name);\n \t\tif (commit)\n"},{"id":"289252","messageId":"20160614212105.GA21445@sigill.intra.peff.net","threadId":"42612","inReplyTo":"xmqqfusf8qh4.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] do not loop around deref_tag()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-14T21:21:05Z","receivedAt":"2016-06-16T06:55:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jun 14, 2016 at 01:28:39PM -0700, Junio C Hamano wrote:\n\n> These callers appear to expect that deref_tag() is to peel one layer\n> of a tag, but the function does not work that way; it has its own\n> loop to unwrap tags until an object that is not a tag appears.\n\nLooks obviously correct.\n\n-Peff\n"}]}