From 56d5dde7526e725a9e590f32fe38ce6b3391bc36 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 27 Sep 2020 04:40:11 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- t/t4201-shortlog.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 't') 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 1 SOB One 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 " >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 -- cgit v1.2.3