diff options
author | Jeff King <peff@peff.net> | 2020-09-27 04:40:11 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-27 12:21:05 -0700 |
commit | 56d5dde7526e725a9e590f32fe38ce6b3391bc36 (patch) | |
tree | fa9c3bd197b2c82945b9659c6fac17b665edad24 /builtin | |
parent | shortlog: rename parse_stdin_ident() (diff) | |
download | tgif-56d5dde7526e725a9e590f32fe38ce6b3391bc36.tar.xz |
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 'builtin')
-rw-r--r-- | builtin/shortlog.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/shortlog.c b/builtin/shortlog.c index e6f4faec7c..28133aec68 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -228,6 +228,7 @@ static void insert_records_from_trailers(struct shortlog *log, 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 @@ -245,12 +246,17 @@ static void insert_records_from_trailers(struct shortlog *log, 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); } |