Skip to content

Commit 9c10d4f

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 10538e2 commit 9c10d4f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

builtin/shortlog.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,6 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
253253
}
254254
oneline_str = oneline.len ? oneline.buf : "<none>";
255255

256-
if (log->groups & SHORTLOG_GROUP_AUTHOR) {
257-
strbuf_reset(&ident);
258-
format_commit_message(commit,
259-
log->email ? "%aN <%aE>" : "%aN",
260-
&ident, &ctx);
261-
if (!HAS_MULTI_BITS(log->groups) ||
262-
strset_add(&dups, ident.buf))
263-
insert_one_record(log, ident.buf, oneline_str);
264-
}
265256
if (log->groups & SHORTLOG_GROUP_COMMITTER) {
266257
strbuf_reset(&ident);
267258
format_commit_message(commit,
@@ -383,6 +374,10 @@ void shortlog_init(struct shortlog *log)
383374

384375
void shortlog_finish_setup(struct shortlog *log)
385376
{
377+
if (log->groups & SHORTLOG_GROUP_AUTHOR)
378+
string_list_append(&log->format,
379+
log->email ? "%aN <%aE>" : "%aN");
380+
386381
string_list_sort(&log->trailers);
387382
}
388383

0 commit comments

Comments
 (0)