git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] refs: add missing remove_on_disk implementation for debug backend
@ 2025-10-24  8:38 RuanXinyu via GitGitGadget
  2025-10-24  9:11 ` Patrick Steinhardt
  0 siblings, 1 reply; 4+ messages in thread
From: RuanXinyu via GitGitGadget @ 2025-10-24  8:38 UTC (permalink / raw)
  To: git; +Cc: RuanXinyu, RuanXinyu

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.

Signed-off-by: Xinyu Ruan <r200981113@gmail.com>
---
    refs: add missing remove_on_disk implementation for debug backend

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2082%2FRuanXinyu%2Ffix-refs-trace-migrate-error-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2082/RuanXinyu/fix-refs-trace-migrate-error-v1
Pull-Request: https://github.com/git/git/pull/2082

 refs/debug.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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

base-commit: 81f86aacc4eb74cdb9c2c8082d36d2070c666045
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend
  2025-10-24  8:38 [PATCH] refs: add missing remove_on_disk implementation for debug backend RuanXinyu via GitGitGadget
@ 2025-10-24  9:11 ` Patrick Steinhardt
  2025-10-24 15:13   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Steinhardt @ 2025-10-24  9:11 UTC (permalink / raw)
  To: RuanXinyu via GitGitGadget; +Cc: git, RuanXinyu, RuanXinyu

On Fri, Oct 24, 2025 at 08:38:14AM +0000, RuanXinyu via GitGitGadget wrote:
> 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.

> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend
  2025-10-24  9:11 ` Patrick Steinhardt
@ 2025-10-24 15:13   ` Junio C Hamano
  2025-10-27  4:01     ` 阮新宇
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2025-10-24 15:13 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: RuanXinyu via GitGitGadget, git, RuanXinyu, RuanXinyu

Patrick Steinhardt <ps@pks.im> writes:

>> 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.

It may not warrant a new version in the sense that I could tweak
while queuing, but I need to be told which between the two is the
name to be used before doing so.

I can make a guess and use the latter but it would cause me yet
another piece of extra work if I guessed incorrectly, so...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend
  2025-10-24 15:13   ` Junio C Hamano
@ 2025-10-27  4:01     ` 阮新宇
  0 siblings, 0 replies; 4+ messages in thread
From: 阮新宇 @ 2025-10-27  4:01 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Patrick Steinhardt, RuanXinyu via GitGitGadget, git, RuanXinyu

On Fri, Oct 24, 2025 at 11:13 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Patrick Steinhardt <ps@pks.im> writes:
>
> >> 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.
>
> It may not warrant a new version in the sense that I could tweak
> while queuing, but I need to be told which between the two is the
> name to be used before doing so.
>
> I can make a guess and use the latter but it would cause me yet
> another piece of extra work if I guessed incorrectly, so...

Please use "Xinyu Ruan" for both author and Signed-off-by.
Sorry for the confusion, and thanks for fixing it while queuing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-27  4:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24  8:38 [PATCH] refs: add missing remove_on_disk implementation for debug backend RuanXinyu via GitGitGadget
2025-10-24  9:11 ` Patrick Steinhardt
2025-10-24 15:13   ` Junio C Hamano
2025-10-27  4:01     ` 阮新宇

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).