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

Re: [PATCH 1/2] replay: handle failure to create commits

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 28, 2026, 07:41 UTC
Message-ID
<aroaLu02NQ65Y2Ju@pks.im>
In-Reply-To
<20260925205348.1210154-2-pmonette@google.com>
On Fri, Sep 25, 2026 at 04:53:47PM -0400, Patrick Monette wrote:
Show 11 quoted lines
> When pick_regular_commit() returns NULL, the caller relies on
> `result->clean` to figure out what happened. 1 means success, 0 means a
> conflict, and a negative value means an error.
> 
> Right now, if the commit creation fails, `result->clean` stays at 1. The
> caller doesn't expect the combination of NULL + clean == 1, so it breaks
> out of the loop, but the rest of the function treats this as a success.
> 
> The next commit will add a failure mode (signing) to the commit
> creation, so this needs to be handled correctly. Set `result->clean`
> to -1 when the commit creation fails.
True, this is something we should fix indeed.
Show 15 quoted lines
> diff --git a/replay.c b/replay.c
> index f415103023..ad87863565 100644
> --- a/replay.c
> +++ b/replay.c
> @@ -361,7 +362,11 @@ static struct commit *pick_regular_commit(struct repository *repo,
>  		}
>  	}
>  
> -	return create_commit(repo, result->tree, pickme, replayed_base, mode);
> +	new_commit = create_commit(repo, result->tree, pickme, replayed_base,
> +				   mode);
> +	if (!new_commit)
> +		result->clean = -1;
> +	return new_commit;
>  }

Other error paths end up printing an error message. But we don't have to because `create_commit()` already knows to do that for us.

Patrick
Previous: Patrick MonetteNext: Patrick Monette
Message 3 of 8 in “replay: add signing support”
  1. 0/2 replay: add signing supportPatrick Monette, Sep 25, 2026
  2. 1/2 replay: handle failure to create commitsPatrick Monette, Sep 25, 2026
  3. Patrick SteinhardtSep 28, 2026
  4. 2/2 replay: add the -S optionPatrick Monette, Sep 25, 2026
  5. Patrick SteinhardtSep 28, 2026
  6. Junio C HamanoOct 2, 2026
  7. Patrick SteinhardtSep 28, 2026
  8. Junio C HamanoSep 28, 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.