shortlog: support arbitrary commit format `--group`s
commit3dc95e09e1355ebde472bd5be37aa7b29ef774d3
authorTaylor Blau <me@ttaylorr.com>
Mon, 24 Oct 2022 18:55:39 +0000 (24 14:55 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Oct 2022 21:48:05 +0000 (24 14:48 -0700)
tree3f9eabadf001c1bf6d1946c6b6df6d48984b8b4b
parentb017d3dae9fe5a5b636b8f7a5235cee2b1b90332
shortlog: support arbitrary commit format `--group`s

In addition to generating a shortlog based on committer, author, or the
identity in one or more specified trailers, it can be useful to generate
a shortlog based on an arbitrary commit format.

This can be used, for example, to generate a distribution of commit
activity over time, like so:

    $ git shortlog --group='%cd' --date='format:%Y-%m' -s v2.37.0..
       117  2022-06
       274  2022-07
       324  2022-08
       263  2022-09
         7  2022-10

Arbitrary commit formats can be used. In fact, `git shortlog`'s default
behavior (to count by commit authors) can be emulated as follows:

    $ git shortlog --group='%aN <%aE>' ...

and future patches will make the default behavior (as well as
`--committer`, and `--group=trailer:<trailer>`) special cases of the
more flexible `--group` option.

Note also that the SHORTLOG_GROUP_FORMAT enum value is used only to
designate that `--group:<format>` is in use when in stdin mode to
declare that the combination is invalid.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-shortlog.txt
builtin/shortlog.c
shortlog.h
t/t4201-shortlog.sh