Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-09-27 11:40:07 +0300
committerJunio C Hamano <gitster@pobox.com>2020-09-27 22:21:05 +0300
commitf17b0b99bf2dc2fcd74544ce35d058e558e6b056 (patch)
tree9bdcbc31e0f5d80caaa399b0ec1a5e32444b5d13 /t/t4201-shortlog.sh
parent47beb37bc60b690e83b19aa7ff646255fb643ad9 (diff)
shortlog: de-duplicate trailer values
The current documentation is vague about what happens with --group=trailer:signed-off-by when we see a commit with: Signed-off-by: One Signed-off-by: Two Signed-off-by: One We clearly should credit both "One" and "Two", but should "One" get credited twice? The current code does so, but mostly because that was the easiest thing to do. It's probably more useful to count each commit at most once. This will become especially important when we allow values from multiple sources in a future patch. 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.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index e97d891a71..83dbbc44e8 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -234,4 +234,32 @@ test_expect_success 'shortlog --group=trailer:signed-off-by' '
test_cmp expect actual
'
+test_expect_success 'shortlog de-duplicates trailers in a single commit' '
+ git commit --allow-empty -F - <<-\EOF &&
+ subject one
+
+ this message has two distinct values, plus a repeat
+
+ Repeated-trailer: Foo
+ Repeated-trailer: Bar
+ Repeated-trailer: Foo
+ EOF
+
+ git commit --allow-empty -F - <<-\EOF &&
+ subject two
+
+ similar to the previous, but without the second distinct value
+
+ Repeated-trailer: Foo
+ Repeated-trailer: Foo
+ EOF
+
+ cat >expect <<-\EOF &&
+ 2 Foo
+ 1 Bar
+ EOF
+ git shortlog -ns --group=trailer:repeated-trailer -2 HEAD >actual &&
+ test_cmp expect actual
+'
+
test_done