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:
authorTaylor Blau <me@ttaylorr.com>2022-10-24 21:55:44 +0300
committerJunio C Hamano <gitster@pobox.com>2022-10-25 00:48:05 +0300
commit9c10d4ff2401cd5908e4e874c403fadebb2ac0b3 (patch)
treedd28672d0538e5b12928c984973bcc8e4dc7c42d /builtin
parent10538e2a627b8ab14f977c868f2975a2acb4ed4d (diff)
shortlog: implement `--group=author` in terms of `--group=<format>`
Instead of handling SHORTLOG_GROUP_AUTHOR separately, reimplement it as a special case of the new `--group=<format>` mode, where the author mode is a shorthand for `--group='%aN <%aE>'. Note that we still need to keep the SHORTLOG_GROUP_AUTHOR enum since it has a different meaning in `read_from_stdin()`, where it is still used for a different purpose. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/shortlog.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 808bae9baa..f6032c6328 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -253,15 +253,6 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
}
oneline_str = oneline.len ? oneline.buf : "<none>";
- if (log->groups & SHORTLOG_GROUP_AUTHOR) {
- strbuf_reset(&ident);
- format_commit_message(commit,
- log->email ? "%aN <%aE>" : "%aN",
- &ident, &ctx);
- if (!HAS_MULTI_BITS(log->groups) ||
- strset_add(&dups, ident.buf))
- insert_one_record(log, ident.buf, oneline_str);
- }
if (log->groups & SHORTLOG_GROUP_COMMITTER) {
strbuf_reset(&ident);
format_commit_message(commit,
@@ -383,6 +374,10 @@ void shortlog_init(struct shortlog *log)
void shortlog_finish_setup(struct shortlog *log)
{
+ if (log->groups & SHORTLOG_GROUP_AUTHOR)
+ string_list_append(&log->format,
+ log->email ? "%aN <%aE>" : "%aN");
+
string_list_sort(&log->trailers);
}