summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2020-09-27 04:40:11 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-09-27 12:21:05 -0700
commit56d5dde7526e725a9e590f32fe38ce6b3391bc36 (patch)
treefa9c3bd197b2c82945b9659c6fac17b665edad24 /t
parentshortlog: rename parse_stdin_ident() (diff)
downloadtgif-56d5dde7526e725a9e590f32fe38ce6b3391bc36.tar.xz
shortlog: parse trailer idents
Trailers don't necessarily contain name/email identity values, so shortlog has so far treated them as opaque strings. However, since many trailers do contain identities, it's useful to treat them as such when they can be parsed. That lets "-e" work as usual, as well as mailmap. When they can't be parsed, we'll continue with the old behavior of treating them as a single string (there's no new test for that here, since the existing tests cover a trailer like this). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4201-shortlog.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index 83dbbc44e8..a62ee9ed55 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -230,10 +230,30 @@ test_expect_success 'shortlog --group=trailer:signed-off-by' '
2 C O Mitter <committer@example.com>
1 SOB One <sob@example.com>
EOF
+ git shortlog -nse --group=trailer:signed-off-by HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'trailer idents are split' '
+ cat >expect <<-\EOF &&
+ 2 C O Mitter
+ 1 SOB One
+ EOF
git shortlog -ns --group=trailer:signed-off-by HEAD >actual &&
test_cmp expect actual
'
+test_expect_success 'trailer idents are mailmapped' '
+ cat >expect <<-\EOF &&
+ 2 C O Mitter
+ 1 Another Name
+ EOF
+ echo "Another Name <sob@example.com>" >mail.map &&
+ git -c mailmap.file=mail.map shortlog -ns \
+ --group=trailer:signed-off-by HEAD >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'shortlog de-duplicates trailers in a single commit' '
git commit --allow-empty -F - <<-\EOF &&
subject one