summaryrefslogtreecommitdiff
path: root/t/t4201-shortlog.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-09-27 08:40:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-27 19:21:05 (GMT)
commit56d5dde7526e725a9e590f32fe38ce6b3391bc36 (patch)
treefa9c3bd197b2c82945b9659c6fac17b665edad24 /t/t4201-shortlog.sh
parent87abb96222b076a1a9aa9c92f799107141feeca4 (diff)
downloadgit-56d5dde7526e725a9e590f32fe38ce6b3391bc36.zip
git-56d5dde7526e725a9e590f32fe38ce6b3391bc36.tar.gz
git-56d5dde7526e725a9e590f32fe38ce6b3391bc36.tar.bz2
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/t4201-shortlog.sh')
-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 83dbbc4..a62ee9e 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