Subject: Re: [RFC PATCH] builtin/format-patch: print a warning for skipped merge commits?

From: Dominique Martinet <[email-masked]>
Date: Sun, 1 Feb 2026 17:38:58 +0900

(It took me a while to get back to this...)

Junio C Hamano wrote on Sun, Jan 04, 2026 at 11:27:01AM +0900:
> Dominique Martinet <[email-masked]> writes:
> > Okay, I can see this being confusing to people not used to format-patch
> > even with a range, but I agree it'll be annoying more often than not in
> > general so I'm fine with this.
> 
> Yup, nobody stays to be newbie forever ;-).

I think I actually fell in this newbie category myself: I hadn't
realized how hard it is to specify exactly only a merge commit in normal
git usage.

In "confusing case" I was consulted about, Julien had used jj to
(involuntarily) make a merge commit that merged two parent commits like
this:
$ jj log
○  mkwklvul Julien Moutinho 1 hour ago openvpn* 0ef9a661
│  nixos/openvpn: format with nixfmt-rfc-style
@    qsusmwyp Julien Moutinho 1 hour ago 14ef78b3
├─╮  nixos/openvpn: add netns support
○ │  vltlsmty Julien Moutinho 23 hours ago services.netns git_head() 204ac248
├─╯  nixos/netns: init module to manage network namespaces
◆  ktsspxvy Yohann Boniface 1 day ago master@NixOS 04245c47
│  (empty) arduino-cli: 1.3.1 -> 1.4.0, use finalAttrs (#469365)

So specifying `git format-patch 14ef78b3^-` wouldn't generate any
commit;
but in the normal merge case using foo^- will grab commits that are in
the second parent that aren't in the first, so to get only the merge
commit you'd need to write `foo^- --not foo^2` or some other more
complex expression...
At which point I'm not sure this warning has much benefit, and the real
problem would more be that jj let him create such an useless merge
commit with non-trivial content..

If it was just very rarely useful I might still be tempted to send the
patch, but it also breaks patch counting with e.g. `git format-patch -3`
(test t4014-format-patch.sh "format-patch doesn't consider merge
commits"):
the -3 is done by common revision `.max_count` limit, so dropping
`rev.max_parents = 1` makes format-patch skip through merge commits
without re-adding further commits, and I'm not convinced this is all
worth it.

So, thank you for the quick replies (over new year festivities no
less!), but let's leave it at this unless something compelling comes
up...

Thanks,
-- 
Dominique Martinet | Asmadeus