]> git.ipfire.org Git - thirdparty/git.git/commitdiff
blame, line-log: do not loop around deref_tag()
authorJunio C Hamano <gitster@pobox.com>
Tue, 14 Jun 2016 20:38:14 +0000 (13:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Jun 2016 20:38:14 +0000 (13:38 -0700)
These callers appear to expect that deref_tag() is to peel one layer
of a tag, but the function does not work that way; it has its own
loop to unwrap tags until an object that is not a tag appears.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c
line-log.c

index 048ed53c2f70961898d3d2a213e05315ae1ac92d..0136dfcffa3a847e33e15b2dcc4d9db1257c028b 100644 (file)
@@ -2400,8 +2400,7 @@ static char *prepare_final(struct scoreboard *sb)
                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)
@@ -2428,8 +2427,7 @@ static char *prepare_initial(struct scoreboard *sb)
                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)
index 626b22cc31726c146347f44d73daa80b776ab74f..2aa33be69331412fc20a3b40c538169fd2af14b5 100644 (file)
@@ -479,8 +479,7 @@ static struct commit *check_single_commit(struct rev_info *revs)
                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 (commit)