Skip to content

Commit 31da121

Browse files
committed
blame, line-log: do not loop around deref_tag()
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 <[email protected]>
1 parent 7654286 commit 31da121

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

builtin/blame.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,8 +2400,7 @@ static char *prepare_final(struct scoreboard *sb)
24002400
struct object *obj = revs->pending.objects[i].item;
24012401
if (obj->flags & UNINTERESTING)
24022402
continue;
2403-
while (obj->type == OBJ_TAG)
2404-
obj = deref_tag(obj, NULL, 0);
2403+
obj = deref_tag(obj, NULL, 0);
24052404
if (obj->type != OBJ_COMMIT)
24062405
die("Non commit %s?", revs->pending.objects[i].name);
24072406
if (sb->final)
@@ -2428,8 +2427,7 @@ static char *prepare_initial(struct scoreboard *sb)
24282427
struct object *obj = revs->pending.objects[i].item;
24292428
if (!(obj->flags & UNINTERESTING))
24302429
continue;
2431-
while (obj->type == OBJ_TAG)
2432-
obj = deref_tag(obj, NULL, 0);
2430+
obj = deref_tag(obj, NULL, 0);
24332431
if (obj->type != OBJ_COMMIT)
24342432
die("Non commit %s?", revs->pending.objects[i].name);
24352433
if (sb->final)

line-log.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ static struct commit *check_single_commit(struct rev_info *revs)
479479
struct object *obj = revs->pending.objects[i].item;
480480
if (obj->flags & UNINTERESTING)
481481
continue;
482-
while (obj->type == OBJ_TAG)
483-
obj = deref_tag(obj, NULL, 0);
482+
obj = deref_tag(obj, NULL, 0);
484483
if (obj->type != OBJ_COMMIT)
485484
die("Non commit %s?", revs->pending.objects[i].name);
486485
if (commit)

0 commit comments

Comments
 (0)