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

github.com/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:11 +0300
committerJunio C Hamano <gitster@pobox.com>2020-09-27 22:21:05 +0300
commit56d5dde7526e725a9e590f32fe38ce6b3391bc36 (patch)
treefa9c3bd197b2c82945b9659c6fac17b665edad24 /builtin/shortlog.c
parent87abb96222b076a1a9aa9c92f799107141feeca4 (diff)
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/shortlog.c')
-rw-r--r--builtin/shortlog.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index e6f4faec7c2..28133aec685 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);
}