Merge branch 'jc/deref-tag' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 6 Jul 2016 20:06:46 +0000 (13:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Jul 2016 20:06:46 +0000 (13:06 -0700)
Code clean-up.

* jc/deref-tag:
  blame, line-log: do not loop around deref_tag()

1  2 
builtin/blame.c
line-log.c

diff --cc 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)
diff --cc line-log.c
Simple merge