Thread (2 messages) 2 messages, 2 authors, 2025-10-24

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

From: Patrick Steinhardt <hidden>
Date: 2025-10-24 09:11:34

On Fri, Oct 24, 2025 at 08:38:14AM +0000, RuanXinyu via GitGitGadget wrote:
From: RuanXinyu <redacted>

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 <redacted>
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.
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help