Subject: [PATCH v6 0/5] format-patch: add cover-letter-format option

From: Mirko Faina <[email-masked]>
Date: Fri, 6 Mar 2026 23:58:43 +0100

From: Mroik <[email-masked]>

Last version

[1/5] pretty.c: add %(count) and %(total) placeholders (Mirko Faina)
[2/5] format-patch: move cover letter summary generation (Mirko Faina)
[3/5] format-patch: add ability to use alt cover format (Mirko Faina)
[4/5] format-patch: add commitListFormat config (Mirko Faina)
[5/5] docs: add usage for the cover-letter fmt feature (Mirko Faina)

 Documentation/config/format.adoc    |   6 ++
 Documentation/git-format-patch.adoc |  11 +++
 builtin/log.c                       |  91 +++++++++++++++++++++----
 pretty.c                            |  15 +++++
 t/t4014-format-patch.sh             | 101 ++++++++++++++++++++++++++++
 t/t9902-completion.sh               |   1 +
 6 files changed, 211 insertions(+), 14 deletions(-)

Range-diff against v5:
1:  169db9df4d ! 1:  cfed3bddf6 pretty.c: add %(count) and %(total) placeholders
    @@ Commit message
         placeholders.
     
         Signed-off-by: Mirko Faina <[email-masked]>
    -    Signed-off-by: Junio C Hamano <[email-masked]>
     
      ## pretty.c ##
     @@ pretty.c: static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
2:  c69d6409d5 ! 2:  dc131c7565 format-patch: move cover letter summary generation
    @@ Commit message
         commit list using thier own format string.
     
         Signed-off-by: Mirko Faina <[email-masked]>
    -    Signed-off-by: Junio C Hamano <[email-masked]>
     
      ## builtin/log.c ##
     @@ builtin/log.c: static void get_notes_args(struct strvec *arg, struct rev_info *rev)
3:  c3a92d8896 ! 3:  316c9e76ee format-patch: add ability to use alt cover format
    @@ Commit message
         useful than they'd like, mainly because the shortlog groups commits by
         author, and gives no obvious chronological order.
     
    -    Give the ability to format-patch to specify an alternative format spec
    +    Give format-patch the ability to specify an alternative format spec
         through the "--cover-letter-format" option. This option either takes
         "shortlog", which is the current format, or a format spec prefixed with
         "log:".
    @@ Commit message
             ...
     
         Signed-off-by: Mirko Faina <[email-masked]>
    -    Signed-off-by: Junio C Hamano <[email-masked]>
     
      ## builtin/log.c ##
     @@ builtin/log.c: static void generate_shortlog_cover_letter(struct shortlog *log,
      	shortlog_output(log);
      }
      
    -+static void generate_commit_list_cover(FILE *cover_file,const char *format,
    ++static void generate_commit_list_cover(FILE *cover_file, const char *format,
     +				       struct commit **list, int n)
     +{
     +	struct strbuf commit_line = STRBUF_INIT;
4:  a6e4e1ac84 ! 4:  c522f47e5b format-patch: add commitListFormat config
    @@ Commit message
             format.
     
         Signed-off-by: Mirko Faina <[email-masked]>
    -    Signed-off-by: Junio C Hamano <[email-masked]>
     
      ## builtin/log.c ##
     @@ builtin/log.c: struct format_config {
5:  40d1aa8785 ! 5:  1a4ba6dc33 docs: add usage for the cover-letter fmt feature
    @@ Metadata
      ## Commit message ##
         docs: add usage for the cover-letter fmt feature
     
    -    Document the new "--cover-letter-format" feature in format-patch and its
    +    Document the new "--cover-letter-format" option in format-patch and its
         related config variable "format.commitListFormat".
     
         Signed-off-by: Mirko Faina <[email-masked]>
    -    Signed-off-by: Junio C Hamano <[email-masked]>
     
      ## Documentation/config/format.adoc ##
     @@ Documentation/config/format.adoc: format.coverLetter::
    @@ Documentation/config/format.adoc: format.coverLetter::
      	Default is false.
      
     +format.commitListFormat::
    -+	A format string that specifies how to generate the commit list
    -+	of a cover-letter when format-patch is invoked. This is the
    -+	config coupled with `--cover-letter-format` in the format-patch
    -+	command and they both accept the same values.
    -+	Default is shortlog.
    ++	A format string that specifies how to generate the commit list of a
    ++	cover-letter when format-patch is invoked. This config is coupled with
    ++	the `--cover-letter-format` format-patch option command and they both
    ++	accept the same values. Default is `shortlog`.
     +
      format.outputDirectory::
      	Set a custom directory to store the resulting files instead of the
    @@ Documentation/git-format-patch.adoc: feeding the result to `git send-email`.
     +--cover-letter-format=<format-spec>::
     +	Specify the format in which to generate the commit list of the
     +	patch series. This option is available if the user wants to use
    -+	an alternative to the default shortlog format. The accepted
    ++	an alternative to the default `shortlog` format. The accepted
     +	values for format-spec are "shortlog" or a format string
     +	prefixed with `log:`.
     +	e.g. `log: %s (%an)`
-- 
2.53.0.5.g1a4ba6dc33