Skip to content

Commit 7b11234

Browse files
ttaylorrgitster
authored andcommitted
shortlog: implement --group=committer in terms of --group=<format>
In the same spirit as the previous commit, reimplement `--group=committer` as a special case of `--group=<format>`, too. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c10d4f commit 7b11234

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

builtin/shortlog.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ static void insert_records_from_format(struct shortlog *log,
233233

234234
void shortlog_add_commit(struct shortlog *log, struct commit *commit)
235235
{
236-
struct strbuf ident = STRBUF_INIT;
237236
struct strbuf oneline = STRBUF_INIT;
238237
struct strset dups = STRSET_INIT;
239238
struct pretty_print_context ctx = {0};
@@ -253,20 +252,10 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
253252
}
254253
oneline_str = oneline.len ? oneline.buf : "<none>";
255254

256-
if (log->groups & SHORTLOG_GROUP_COMMITTER) {
257-
strbuf_reset(&ident);
258-
format_commit_message(commit,
259-
log->email ? "%cN <%cE>" : "%cN",
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-
}
265255
insert_records_from_trailers(log, &dups, commit, &ctx, oneline_str);
266256
insert_records_from_format(log, &dups, commit, &ctx, oneline_str);
267257

268258
strset_clear(&dups);
269-
strbuf_release(&ident);
270259
strbuf_release(&oneline);
271260
}
272261

@@ -377,6 +366,9 @@ void shortlog_finish_setup(struct shortlog *log)
377366
if (log->groups & SHORTLOG_GROUP_AUTHOR)
378367
string_list_append(&log->format,
379368
log->email ? "%aN <%aE>" : "%aN");
369+
if (log->groups & SHORTLOG_GROUP_COMMITTER)
370+
string_list_append(&log->format,
371+
log->email ? "%cN <%cE>" : "%cN");
380372

381373
string_list_sort(&log->trailers);
382374
}

0 commit comments

Comments
 (0)