be counted more than once (but only once per unique trailer value in
that commit).
+
-The contents of each trailer value are taken literally and completely.
-No mailmap is applied, and the `-e` option has no effect (if the trailer
-contains a username and email, they are both always shown).
+Shortlog will attempt to parse each trailer value as a `name <email>`
+identity. If successful, the mailmap is applied and the email is omitted
+unless the `--email` option is specified. If the value cannot be parsed
+as an identity, it will be taken literally and completely.
-c::
--committer::
struct trailer_iterator iter;
const char *commit_buffer, *body;
struct strset dups = STRSET_INIT;
+ struct strbuf ident = STRBUF_INIT;
/*
* Using format_commit_message("%B") would be simpler here, but
if (strcasecmp(iter.key.buf, log->trailer))
continue;
+ strbuf_reset(&ident);
+ if (!parse_ident(log, &ident, value))
+ value = ident.buf;
+
if (strset_check_and_add(&dups, value))
continue;
insert_one_record(log, value, oneline);
}
trailer_iterator_release(&iter);
+ strbuf_release(&ident);
strset_clear(&dups);
unuse_commit_buffer(commit, commit_buffer);
}
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