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
Jeff King <peff@peff.net>
Date
Jan 2, 2026, 07:33 UTC
Message-ID
<20260102073358.GC2581074@coredump.intra.peff.net>
In-Reply-To
<20251231034217.2498648-1-asmadeus@codewreck.org>
On Wed, Dec 31, 2025 at 12:42:17PM +0900, Dominique Martinet wrote:
Show 9 quoted lines
> @@ -2274,6 +2273,11 @@ int cmd_format_patch(int argc,
>  		die(_("revision walk setup failed"));
>  	rev.boundary = 1;
>  	while ((commit = get_revision(&rev)) != NULL) {
> +		if (commit->parents->next) {
> +			warning(_("skipped merge commit %s"),
> +				oid_to_hex(&commit->object.oid));
> +			continue;
> +		}

I don't have any thoughts on whether the patch is overall a good direction or not, but I suspect this line will segfault if we ever see a root commit. You probably want:

  if (commit->parents && commit->parents->next)
here.
-Peff
Previous: Junio C HamanoNext: Dominique Martinet
Message 3 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.