git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v8 3/4] format-patch: add "chronological" format for cover

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 12, 2026, 16:55 UTC
Message-ID
<xmqq1phpgf7f.fsf@gitster.g>
In-Reply-To
<b67f1c9603bac9ea464357c77743e71c27003bd2.1773331753.git.mroik@delayed.space>
Mirko Faina <mroik@delayed.space> writes:
Show 5 quoted lines
> Having a user craft a custom format spec everytime might be a hassle,
> and having a common format that seems reasonable might make reviews
> easier. This patch introduces a new simple preset called "chronological".
>
> Teach make_cover_letter() the "chronological" format.

OK. The "a fixed 'log:' prefix is still needed for future proofing" comment from my review on an earlier step of this series still applies after this step.

Show 61 quoted lines
> Signed-off-by: Mirko Faina <mroik@delayed.space>
> ---
>  Documentation/git-format-patch.adoc |  2 +-
>  builtin/log.c                       |  3 +++
>  t/t4014-format-patch.sh             | 11 +++++++++++
>  3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-format-patch.adoc b/Documentation/git-format-patch.adoc
> index de36b87a85..6364fd1f5a 100644
> --- a/Documentation/git-format-patch.adoc
> +++ b/Documentation/git-format-patch.adoc
> @@ -326,7 +326,7 @@ feeding the result to `git send-email`.
>  	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 values for
> -	format-spec are "shortlog" or a format string.
> +	format-spec are "shortlog", "chronological" or a format string.
>  	e.g. `%s (%an)`
>  	If defined, defaults to the `format.commitListFormat` configuration
>  	variable.
> diff --git a/builtin/log.c b/builtin/log.c
> index 4f22012395..12877a0ac2 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -50,6 +50,7 @@
>  #define MAIL_DEFAULT_WRAP 72
>  #define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
>  #define FORMAT_PATCH_NAME_MAX_DEFAULT 64
> +#define CHRONOLOGICAL "[%(count)/%(total)] %s"
>  
>  static unsigned int force_in_body_from;
>  static int stdout_mboxrd;
> @@ -1420,6 +1421,8 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
>  
>  	if (format == NULL || !strcmp(format, "shortlog"))
>  		generate_shortlog_cover_letter(&log, rev, list, nr);
> +	else if (!strcmp(format, "chronological"))
> +		generate_commit_list_cover(rev->diffopt.file, CHRONOLOGICAL, list, nr);
>  	else
>  		generate_commit_list_cover(rev->diffopt.file, format, list, nr);
>  
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 631669c159..5ec527bce9 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -392,6 +392,17 @@ test_expect_success 'cover letter with subject, author and count' '
>  	test_grep "^\[1/1\] This is a subject (A U Thor)$" patches/0000-cover-letter.patch
>  '
>  
> +test_expect_success 'cover letter chronological' '
> +	test_when_finished "git reset --hard HEAD~1" &&
> +	test_when_finished "rm -rf patches result test_file" &&
> +	touch test_file &&
> +	git add test_file &&
> +	git commit -m "This is a subject" &&
> +	git format-patch --cover-letter \
> +	--cover-letter-format="chronological" -o patches HEAD~1 &&
> +	test_grep "^\[1/1\] This is a subject$" patches/0000-cover-letter.patch
> +'
> +
>  cat > expected <<EOF
Previous: Junio C HamanoNext: Junio C Hamano
Message 102 of 113 in “format-patch: better commit list for cover letter”
  1. format-patch: better commit list for cover letterMirko Faina, Feb 20, 2026
  2. format-patch: better commit list for cover letterMirko Faina, Feb 20, 2026
  3. Mirko FainaFeb 21, 2026
  4. Junio C HamanoFeb 21, 2026
  5. Mirko FainaFeb 21, 2026
  6. Junio C HamanoFeb 21, 2026
  7. Junio C HamanoFeb 21, 2026
  8. Mirko FainaFeb 21, 2026
  9. Junio C HamanoFeb 21, 2026
  10. Mirko FainaFeb 21, 2026
  11. 0/3 format-patch: add cover-letter-format optionMirko Faina, Feb 24, 2026
  12. 1/3 pretty.c: fix null pointer dereferenceMirko Faina, Feb 24, 2026
  13. 2/3 format-patch: add ability to use alt cover formatMirko Faina, Feb 24, 2026
  14. 3/3 format-patch: add commitListFormat configMirko Faina, Feb 24, 2026
  15. Mirko FainaFeb 24, 2026
  16. Junio C HamanoFeb 24, 2026
  17. Mirko FainaFeb 24, 2026
  18. Mirko FainaFeb 24, 2026
  19. Jeff KingFeb 24, 2026
  20. Jeff KingFeb 24, 2026
  21. Mirko FainaFeb 24, 2026
  22. Jeff KingFeb 24, 2026
  23. 0/2 format-patch: add cover-letter-format optionMirko Faina, Feb 24, 2026
  24. 1/2 format-patch: add ability to use alt cover formatMirko Faina, Feb 24, 2026
  25. 2/2 format-patch: add commitListFormat configMirko Faina, Feb 24, 2026
  26. Junio C HamanoFeb 24, 2026
  27. Junio C HamanoFeb 24, 2026
  28. Junio C HamanoFeb 24, 2026
  29. Junio C HamanoFeb 24, 2026
  30. Junio C HamanoFeb 24, 2026
  31. Mirko FainaFeb 24, 2026
  32. Mirko FainaFeb 25, 2026
  33. Mirko FainaFeb 25, 2026
  34. Junio C HamanoFeb 25, 2026
  35. Junio C HamanoFeb 25, 2026
  36. Jeff KingFeb 25, 2026
  37. Jeff KingFeb 25, 2026
  38. Junio C HamanoFeb 25, 2026
  39. Mirko FainaFeb 25, 2026
  40. Mirko FainaFeb 26, 2026
  41. Junio C HamanoFeb 26, 2026
  42. 1/4 pretty.c: add %(count) and %(total) placeholdersMirko Faina, Feb 27, 2026
  43. 0/4 format-patch: add cover-letter-format optionMirko Faina, Feb 27, 2026
  44. 2/4 format-patch: move cover letter summary generationMirko Faina, Feb 27, 2026
  45. 4/4 format-patch: add commitListFormat configMirko Faina, Feb 27, 2026
  46. 3/4 format-patch: add ability to use alt cover formatMirko Faina, Feb 27, 2026
  47. Junio C HamanoFeb 27, 2026
  48. Mirko FainaFeb 27, 2026
  49. 0/4 format-patch: add cover-letter-format optionMirko Faina, Feb 27, 2026
  50. 1/4 pretty.c: add %(count) and %(total) placeholdersMirko Faina, Feb 27, 2026
  51. 3/4 format-patch: add ability to use alt cover formatMirko Faina, Feb 27, 2026
  52. 2/4 format-patch: move cover letter summary generationMirko Faina, Feb 27, 2026
  53. 4/4 format-patch: add commitListFormat configMirko Faina, Feb 27, 2026
  54. 5/4 docs: add usage for the cover-letter fmt featureMirko Faina, Feb 27, 2026
  55. Junio C HamanoFeb 27, 2026
  56. Mirko FainaFeb 27, 2026
  57. Junio C HamanoFeb 27, 2026
  58. 0/5 format-patch: add cover-letter-format optionMirko Faina, Feb 27, 2026
  59. 1/5 pretty.c: add %(count) and %(total) placeholdersMirko Faina, Feb 27, 2026
  60. 2/5 format-patch: move cover letter summary generationMirko Faina, Feb 27, 2026
  61. 3/5 format-patch: add ability to use alt cover formatMirko Faina, Feb 27, 2026
  62. 4/5 format-patch: add commitListFormat configMirko Faina, Feb 27, 2026
  63. 5/5 docs: add usage for the cover-letter fmt featureMirko Faina, Feb 27, 2026
  64. Junio C HamanoMar 6, 2026
  65. Mirko FainaMar 6, 2026
  66. 1/5 pretty.c: add %(count) and %(total) placeholdersMirko Faina, Mar 6, 2026
  67. 0/5 format-patch: add cover-letter-format optionMirko Faina, Mar 6, 2026
  68. 2/5 format-patch: move cover letter summary generationMirko Faina, Mar 6, 2026
  69. 3/5 format-patch: add ability to use alt cover formatMirko Faina, Mar 6, 2026
  70. 4/5 format-patch: add commitListFormat configMirko Faina, Mar 6, 2026
  71. 5/5 docs: add usage for the cover-letter fmt featureMirko Faina, Mar 6, 2026
  72. Junio C HamanoMar 6, 2026
  73. 0/5 format-patch: add cover-letter-format optionMirko Faina, Mar 6, 2026
  74. 1/5 pretty.c: add %(count) and %(total) placeholdersMirko Faina, Mar 6, 2026
  75. 2/5 format-patch: move cover letter summary generationMirko Faina, Mar 6, 2026
  76. 3/5 format-patch: add ability to use alt cover formatMirko Faina, Mar 6, 2026
  77. 4/5 format-patch: add commitListFormat configMirko Faina, Mar 6, 2026
  78. 5/5 docs: add usage for the cover-letter fmt featureMirko Faina, Mar 6, 2026
  79. Bert WesargMar 10, 2026
  80. Phillip WoodMar 10, 2026
  81. Phillip WoodMar 10, 2026
  82. Phillip WoodMar 10, 2026
  83. Phillip WoodMar 10, 2026
  84. Junio C HamanoMar 10, 2026
  85. Mirko FainaMar 10, 2026
  86. MroikMar 10, 2026
  87. Mirko FainaMar 10, 2026
  88. Mirko FainaMar 10, 2026
  89. Junio C HamanoMar 10, 2026
  90. Mirko FainaMar 10, 2026
  91. Phillip WoodMar 11, 2026
  92. Phillip WoodMar 11, 2026
  93. Junio C HamanoMar 11, 2026
  94. Junio C HamanoMar 11, 2026
  95. 0/4 format-patch: add cover-letter-format optionMirko Faina, Mar 12, 2026
  96. 1/4 format-patch: move cover letter summary generationMirko Faina, Mar 12, 2026
  97. 2/4 format-patch: add ability to use alt cover formatMirko Faina, Mar 12, 2026
  98. 3/4 format-patch: add "chronological" format for coverMirko Faina, Mar 12, 2026
  99. 4/4 format-patch: add commitListFormat configMirko Faina, Mar 12, 2026
  100. Junio C HamanoMar 12, 2026
  101. Junio C HamanoMar 12, 2026
  102. Junio C HamanoMar 12, 2026
  103. Junio C HamanoMar 12, 2026
  104. Mirko FainaMar 12, 2026
  105. Junio C HamanoMar 12, 2026
  106. Junio C HamanoMar 12, 2026
  107. Junio C HamanoMar 12, 2026
  108. Mirko FainaMar 12, 2026
  109. Junio C HamanoMar 12, 2026
  110. Phillip WoodMar 13, 2026
  111. Junio C HamanoMar 13, 2026
  112. Mirko FainaMar 13, 2026
  113. Junio C HamanoMar 13, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.