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

Re: [PATCH v2] format-patch: fix From header in cover letter

From
Jeff King <peff@peff.net>
Date
Feb 19, 2026, 11:43 UTC
Message-ID
<20260219114307.GC3529@coredump.intra.peff.net>
In-Reply-To
<xmqqecmje6o6.fsf@gitster.g>
On Tue, Feb 17, 2026 at 07:22:33AM -0800, Junio C Hamano wrote:
Show 9 quoted lines
> > I never
> > use it (and I probably forgot it even existed, given that most people
> > would use send-email's cover letter generation, and I do my own thing
> > with mutt).
> 
> I use it myself and I really hate the way it lists the patches.  We
> should have done "log --oneline --reverse" instead of "shortlog", as
> it is hard to understand the reference the cover letter message
> makes to individual patches like "the first two patches do X", etc.

Agreed. I have long hated the shortlog version. According to the commit history of my personal scripts, I've been sending with:

   [1/3]: subject of the first patch
   [2/3]: the second patch
   [3/3]: and so on
since at least 2009, and nobody has complained. ;)

Sadly I don't think there is an easy way to do so with "log --format", as it can't just be a single output placeholder (you have to do the whole traversal to get the "/3" part, so the caller needs to know this and queue up the output).

I do it locally by piping the format-patch output through something like:

  sed -ne 's/^Subject: //p' |
  sed -e 's/\[PATCH /[/' \
      -e 's/]/]:/' \
      -e 's/^/  /'

Of course that does not handle rfc822 header continuations, which we started to do at some point for long subjects. So now the first part is some gnarly perl. :-/

Probably some combination of "git log --format=%s", "nl", "wc -l" would be less horrid. I stuck with format-patch because of its somewhat magical command-line parsing of revisions. E.g., saying "git format-patch @{upstream}" will give you the patches on the topic branch, rather than all history down to the roots.

But anyway, if this were happening internally in format-patch's cover-letter code, it should be quite easy to do (we have the complete list of patches and their subjects there already).

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 17 in “format-patch: fix from header in cover letter”
  1. format-patch: fix from header in cover letterMirko Faina, Feb 14, 2026
  2. Junio C HamanoFeb 16, 2026
  3. format-patch: fix From header in cover letterMirko Faina, Feb 16, 2026
  4. Patrick SteinhardtFeb 17, 2026
  5. Jeff KingFeb 17, 2026
  6. D. Ben KnobleFeb 17, 2026
  7. Jeff KingFeb 19, 2026
  8. Mirko FainaFeb 19, 2026
  9. D. Ben KnobleFeb 19, 2026
  10. Junio C HamanoFeb 17, 2026
  11. Jeff KingFeb 19, 2026
  12. Junio C HamanoFeb 20, 2026
  13. format-patch: fix From header in cover letterMroik, Feb 17, 2026
  14. Mirko FainaFeb 17, 2026
  15. Junio C HamanoFeb 17, 2026
  16. Junio C HamanoFeb 17, 2026
  17. format-patch: fix From header in cover letterMirko Faina, Feb 17, 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.