From: Junio C Hamano Date: Wed, 6 Jul 2016 20:06:46 +0000 (-0700) Subject: Merge branch 'jc/deref-tag' into maint X-Git-Tag: v2.9.1~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f83819835763c2448abc2c18c4fe750368408264;p=git Merge branch 'jc/deref-tag' into maint Code clean-up. * jc/deref-tag: blame, line-log: do not loop around deref_tag() --- f83819835763c2448abc2c18c4fe750368408264 diff --cc builtin/blame.c index 21f42b0b62,0136dfcffa..7417edf6ef --- a/builtin/blame.c +++ b/builtin/blame.c @@@ -2425,26 -2400,17 +2425,25 @@@ static struct commit *find_single_final struct object *obj = revs->pending.objects[i].item; if (obj->flags & UNINTERESTING) continue; - while (obj->type == OBJ_TAG) - obj = deref_tag(obj, NULL, 0); + obj = deref_tag(obj, NULL, 0); if (obj->type != OBJ_COMMIT) die("Non commit %s?", revs->pending.objects[i].name); - if (sb->final) + if (found) die("More than one commit to dig from %s and %s?", - revs->pending.objects[i].name, - final_commit_name); - sb->final = (struct commit *) obj; - final_commit_name = revs->pending.objects[i].name; + revs->pending.objects[i].name, name); + found = (struct commit *)obj; + name = revs->pending.objects[i].name; } - return xstrdup_or_null(final_commit_name); + if (name_p) + *name_p = name; + return found; +} + +static char *prepare_final(struct scoreboard *sb) +{ + const char *name; + sb->final = find_single_final(sb->revs, &name); + return xstrdup_or_null(name); } static char *prepare_initial(struct scoreboard *sb)