public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Patrick Steinhardt <ps@pks.im>, Mirko Faina <mroik@delayed.space>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] format-patch: fix From header in cover letter
Date: Thu, 19 Feb 2026 06:43:07 -0500	[thread overview]
Message-ID: <20260219114307.GC3529@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqecmje6o6.fsf@gitster.g>

On Tue, Feb 17, 2026 at 07:22:33AM -0800, Junio C Hamano wrote:

> > 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

  reply	other threads:[~2026-02-19 11:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-14  5:49 [PATCH] format-patch: fix from header in cover letter Mirko Faina
2026-02-16 11:01 ` Junio C Hamano
2026-02-16 15:27 ` [PATCH v2] format-patch: fix From " Mirko Faina
2026-02-17  6:22   ` Patrick Steinhardt
2026-02-17  6:34     ` Jeff King
2026-02-17 13:21       ` D. Ben Knoble
2026-02-19 11:29         ` Jeff King
2026-02-19 12:03           ` Mirko Faina
2026-02-19 13:43           ` D. Ben Knoble
2026-02-17 15:22       ` Junio C Hamano
2026-02-19 11:43         ` Jeff King [this message]
2026-02-20 18:11           ` Junio C Hamano
2026-02-17 22:04   ` [PATCH] " Mroik
2026-02-17 22:13     ` Mirko Faina
2026-02-17 22:43       ` Junio C Hamano
2026-02-17 22:41     ` Junio C Hamano
2026-02-17 23:25     ` [PATCH v4] " Mirko Faina
  -- strict thread matches above, loose matches on Subject: below --
2026-02-17 21:30 [PATCH v2] " Mirko Faina
2026-02-17 21:41 Mirko Faina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260219114307.GC3529@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mroik@delayed.space \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox