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

Re: [PATCH] replay: move onto NULL check before first use

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
Dec 15, 2025, 12:04 UTC
Message-ID
<a395825a-a9e9-4cde-bf2d-f9b72de9212d@app.fastmail.com>
In-Reply-To
<a017e50f-7c8f-461f-8627-2fd1445d29f6@gmail.com>
On Mon, Dec 15, 2025, at 11:10, Phillip Wood wrote:
Show 10 quoted lines
> On 11/12/2025 17:56, René Scharfe wrote:
>> cmd_replay() aborts if the pointer "onto" is NULL after argument
>> parsing, e.g. when specifying a non-existing commit with --onto.
>> 15cd4ef1f4 (replay: make atomic ref updates the default behavior,
>> 2025-11-06) added code that dereferences this pointer before the check.
>> Switch their places to avoid a segmentation fault.
>
> This fixes the regression nicely. There is a preexisting bug that we
> treat an invalid --onto argument the same as a missing argument but that
> can be fixed separately.

I have a commit cooking (locally) which makes the command die when it cannot find commit-ish for `--onto` or `--advance` (whitespace mangled diff):

```
diff --git a/builtin/replay.c b/builtin/replay.c
index 507b909df7d..72d62aa34a6 100644
--- a/builtin/replay.c
+++ b/builtin/replay.c
@@ -39,7 +39,7 @@ static struct commit *peel_committish(struct repository *repo, const char *name)
 	struct object_id oid;

 	if (repo_get_oid(repo, name, &oid))
-		return NULL;
+		die(_("'%s' is not a valid commit-ish"), name);
 	obj = parse_object(repo, &oid);
 	return (struct commit *)repo_peel_to_type(repo, name, 0, obj,
 						  OBJ_COMMIT);
```

Instead of dieing like this:

    Replaying down to root commit is not supported yet!

I hope that doesn’t cause any leak issues when I test it later.
Previous: Phillip Wood
Message 4 of 4 in “[BUG] replay: segmentation fault when mistyping target to --onto”
  1. Kristoffer HaugsbakkDec 11, 2025
  2. replay: move onto NULL check before first useRené Scharfe, Dec 11, 2025
  3. Phillip WoodDec 15, 2025
  4. Kristoffer HaugsbakkDec 15, 2025

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.