Skip to content

Commit d11ade7

Browse files
committed
Merge branch 'bc/log-decoration' into maint
"git log --decorate" did not handle a tag pointed by another tag nicely. * bc/log-decoration: log: properly handle decorations with chained tags
2 parents 2885624 + 5e1361c commit d11ade7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

log-tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
134134
obj = ((struct tag *)obj)->tagged;
135135
if (!obj)
136136
break;
137+
if (!obj->parsed)
138+
parse_object(obj->sha1);
137139
add_name_decoration(DECORATION_REF_TAG, refname, obj);
138140
}
139141
return 0;

t/t4205-log-pretty-formats.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,19 @@ EOF
310310
test_cmp expected actual
311311
'
312312

313+
test_expect_success 'log decoration properly follows tag chain' '
314+
git tag -a tag1 -m tag1 &&
315+
git tag -a tag2 -m tag2 tag1 &&
316+
git tag -d tag1 &&
317+
git commit --amend -m shorter &&
318+
git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
319+
cat <<EOF >expected &&
320+
6a908c10688b2503073c39c9ba26322c73902bb5 (tag: refs/tags/tag2)
321+
9f716384d92283fb915a4eee5073f030638e05f9 (tag: refs/tags/message-one)
322+
b87e4cccdb77336ea79d89224737be7ea8e95367 (tag: refs/tags/message-two)
323+
EOF
324+
sort actual >actual1 &&
325+
test_cmp expected actual1
326+
'
327+
313328
test_done

0 commit comments

Comments
 (0)