Skip to content

Commit e3073cf

Browse files
committed
Merge branch 'jk/pending-keep-tag-name' into maint
History traversal with "git log --source" that starts with an annotated tag failed to report the tag as "source", due to an old regression in the command line parser back in v2.2 days. * jk/pending-keep-tag-name: revision.c: propagate tag names from pending array
2 parents e002527 + 728350b commit e3073cf

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

revision.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,8 @@ static struct commit *handle_commit(struct rev_info *revs,
294294
/*
295295
* We'll handle the tagged object by looping or dropping
296296
* through to the non-tag handlers below. Do not
297-
* propagate data from the tag's pending entry.
297+
* propagate path data from the tag's pending entry.
298298
*/
299-
name = "";
300299
path = NULL;
301300
mode = 0;
302301
}

t/t4202-log.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,4 +908,33 @@ test_expect_success 'log diagnoses bogus HEAD' '
908908
test_i18ngrep broken stderr
909909
'
910910

911+
test_expect_success 'set up --source tests' '
912+
git checkout --orphan source-a &&
913+
test_commit one &&
914+
test_commit two &&
915+
git checkout -b source-b HEAD^ &&
916+
test_commit three
917+
'
918+
919+
test_expect_success 'log --source paints branch names' '
920+
cat >expect <<-\EOF &&
921+
09e12a9 source-b three
922+
8e393e1 source-a two
923+
1ac6c77 source-b one
924+
EOF
925+
git log --oneline --source source-a source-b >actual &&
926+
test_cmp expect actual
927+
'
928+
929+
test_expect_success 'log --source paints tag names' '
930+
git tag -m tagged source-tag &&
931+
cat >expect <<-\EOF &&
932+
09e12a9 source-tag three
933+
8e393e1 source-a two
934+
1ac6c77 source-tag one
935+
EOF
936+
git log --oneline --source source-tag source-a >actual &&
937+
test_cmp expect actual
938+
'
939+
911940
test_done

0 commit comments

Comments
 (0)