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

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

From
Dominique Martinet <asmadeus@codewreck.org>
Date
Feb 1, 2026, 08:38 UTC
Message-ID
<aX8RIq0ZUSoIue8G@codewreck.org>
In-Reply-To
<xmqqy0mep0y2.fsf@gitster.g>
(It took me a while to get back to this...)
Junio C Hamano wrote on Sun, Jan 04, 2026 at 11:27:01AM +0900:
Show 6 quoted lines
> Dominique Martinet <asmadeus@codewreck.org> 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
Previous: Junio C Hamano
Message 6 of 6 in “builtin/format-patch: print a warning for skipped merge commits?”
  1. builtin/format-patch: print a warning for skipped merge commits?Dominique Martinet, Dec 31, 2025
  2. Junio C HamanoDec 31, 2025
  3. Jeff KingJan 2, 2026
  4. Dominique MartinetJan 3, 2026
  5. Junio C HamanoJan 4, 2026
  6. Dominique MartinetFeb 1, 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.