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

Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 24, 2025, 09:11 UTC
Message-ID
<aPtCvwvNUtFXqrpv@pks.im>
In-Reply-To
<pull.2082.git.git.1761295094982.gitgitgadget@gmail.com>
On Fri, Oct 24, 2025 at 08:38:14AM +0000, RuanXinyu via GitGitGadget wrote:
Show 5 quoted lines
> From: RuanXinyu <r200981113@gmail.com>
> 
> The debug ref backend (refs_be_debug) was missing the remove_on_disk
> function pointer, which caused a segmentation fault when running
> 'GIT_TRACE_REFS=1 git refs migrate --ref-format=reftable' commands.

Heh, funny, just as I said nobody uses this infra you show up :) Good way to prove me wrong, thanks!

> Signed-off-by: Xinyu Ruan <r200981113@gmail.com>

Tiny nit: typically, the author and DCO should match. But the autor is "RuanXinyu" whereas the DCO says "Xinyu Ruan". I don't really think that this is something that warrants a new version, but I wanted to point this out anyway so that you can fix this going forward.

Show 27 quoted lines
> diff --git a/refs/debug.c b/refs/debug.c
> index da300efaf3..dd49080836 100644
> --- a/refs/debug.c
> +++ b/refs/debug.c
> @@ -48,6 +48,14 @@ static int debug_create_on_disk(struct ref_store *refs, int flags, struct strbuf
>  	return res;
>  }
>  
> +static int debug_remove_on_disk(struct ref_store *refs, struct strbuf *err)
> +{
> +	struct debug_ref_store *drefs = (struct debug_ref_store *)refs;
> +	int res = drefs->refs->be->remove_on_disk(drefs->refs, err);
> +	trace_printf_key(&trace_refs, "remove_on_disk: %d\n", res);
> +	return res;
> +}
> +
>  static int debug_transaction_prepare(struct ref_store *refs,
>  				     struct ref_transaction *transaction,
>  				     struct strbuf *err)
> @@ -432,6 +440,7 @@ struct ref_storage_be refs_be_debug = {
>  	.init = NULL,
>  	.release = debug_release,
>  	.create_on_disk = debug_create_on_disk,
> +	.remove_on_disk = debug_remove_on_disk,
>  
>  	/*
>  	 * None of these should be NULL. If the "files" backend (in

Yup, the implementation looks obviously correct to me. Thanks for fixing this bug!

Patrick
Previous: RuanXinyu via GitGitGadgetNext: Junio C Hamano
Message 2 of 4 in “refs: add missing remove_on_disk implementation for debug backend”
  1. refs: add missing remove_on_disk implementation for debug backendRuanXinyu via GitGitGadget, Oct 24, 2025
  2. Patrick SteinhardtOct 24, 2025
  3. Junio C HamanoOct 24, 2025
  4. 阮新宇Oct 27, 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.