On Thu, Oct 20, 2022 at 11:11:29PM -0400, Taylor Blau wrote: > diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt > index f64e77047b..311c041c06 100644 > --- a/Documentation/git-shortlog.txt > +++ b/Documentation/git-shortlog.txt > @@ -47,6 +47,11 @@ OPTIONS > > Each pretty-printed commit will be rewrapped before it is shown. > > +--date=<format>:: > + With a `--group=format:<format>`, show dates formatted > + according to the given date string. (See the `--date` options > + in the "COMMIT FORMATTING" section of linkgit:git-log[1].) I like this much better than including the whole date-formats section. Two nits: - s/options/option/ ? I guess you could say there are "options" for formatting the date, but with "--date" it seems like you'd mean the singular option. - Because "Commit Formatting" is a subsection in git-log(1), the manual will format it with title caps, not all-caps. > diff --git a/builtin/shortlog.c b/builtin/shortlog.c > index 7a1e1fe7c0..53c379a51d 100644 > --- a/builtin/shortlog.c > +++ b/builtin/shortlog.c > @@ -211,7 +211,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit) > ctx.fmt = CMIT_FMT_USERFORMAT; > ctx.abbrev = log->abbrev; > ctx.print_email_subject = 1; > - ctx.date_mode.type = DATE_NORMAL; > + ctx.date_mode = log->date_mode; > ctx.output_encoding = get_log_output_encoding(); > > if (!log->summary) { After the discussion in the last round of whether that funky caller in make_cover_letter() properly initialized the "struct shortlog", I wondered briefly if this would do the right thing for that caller. And it does, because DATE_NORMAL is intentionally set to "0" to allow for zero-initializing (which is what shortlog_init does). Not that it matters in practice, because that caller will not group by nor format using a date, but I was curious if I had inadvertently introduced a gotcha for future callers. But it is good. > diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh > index 3095b1b2ff..7547da539d 100755 > --- a/t/t4201-shortlog.sh > +++ b/t/t4201-shortlog.sh > @@ -83,6 +83,13 @@ test_expect_success 'pretty format' ' > test_cmp expect log.predictable > ' > > +test_expect_success 'pretty format (with --date)' ' > + sed "s/SUBJECT/2005-04-07 OBJECT_NAME/" expect.template >expect && > + git shortlog --format="%ad %H" --date=short HEAD >log && > + fuzz log >log.predictable && > + test_cmp expect log.predictable > +' And this looks sensible. If you dropped "%H" then you wouldn't need to fuzz, and are still testing the interesting part. But just following the whole template/fuzz thing of the surrounding tests is reasonable. -Peff