aboutsummaryrefslogtreecommitdiffstats
path: root/trailer.c
diff options
context:
space:
mode:
authorLinus Arver <linusa@google.com>2024-03-01 00:14:39 +0000
committerJunio C Hamano <gitster@pobox.com>2024-03-01 10:35:42 -0800
commita082e2893868be819b5486e9af3e390a7c948ee2 (patch)
treec1ced9dbafc3c142425628e6bcc1e84efc250b9e /trailer.c
parent0f3a461d4e0f8854181054d86681c0664ae8c0cc (diff)
downloadgit-a082e2893868be819b5486e9af3e390a7c948ee2.tar.gz
shortlog: add test for de-duplicating folded trailers
The shortlog builtin was taught to use the trailer iterator interface in 47beb37bc6 (shortlog: match commit trailers with --group, 2020-09-27). The iterator always unfolds values and this has always been the case since the time the iterator was first introduced in f0939a0eb1 (trailer: add interface for iterating over commit trailers, 2020-09-27). Add a comment line to remind readers of this behavior. The fact that the iterator always unfolds values is important (at least for shortlog) because unfolding allows it to recognize both folded and unfolded versions of the same trailer for de-duplication. Capture the existing behavior in a new test case to guard against regressions in this area. This test case is based off of the existing "shortlog de-duplicates trailers in a single commit" just above it. Now if we were to remove the call to unfold_value(&iter->val); inside the iterator, this new test case will break. Signed-off-by: Linus Arver <linusa@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.c')
-rw-r--r--trailer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/trailer.c b/trailer.c
index e1d83390b6..f74915bd8c 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1270,6 +1270,7 @@ int trailer_iterator_advance(struct trailer_iterator *iter)
strbuf_reset(&iter->val);
parse_trailer(&iter->key, &iter->val, NULL,
trailer, separator_pos);
+ /* Always unfold values during iteration. */
unfold_value(&iter->val);
return 1;
}