{"thread":{"id":"64377","subject":"[PATCH] refs: add missing remove_on_disk implementation for debug backend","startedAt":"2025-10-24T08:38:17Z","lastAt":"2025-10-27T04:02:01Z","messageCount":4,"participants":["RuanXinyu via GitGitGadget","Patrick Steinhardt","Junio C Hamano","阮新宇"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"529573","messageId":"pull.2082.git.git.1761295094982.gitgitgadget@gmail.com","threadId":"64377","inReplyTo":null,"subject":"[PATCH] refs: add missing remove_on_disk implementation for debug backend","fromName":"RuanXinyu via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-10-24T08:38:14Z","receivedAt":"2025-10-24T08:38:17Z","isPatch":true,"sender":{"key":"name:RuanXinyu","avatar":null},"body":"From: RuanXinyu <r200981113@gmail.com>\n\nThe debug ref backend (refs_be_debug) was missing the remove_on_disk\nfunction pointer, which caused a segmentation fault when running\n'GIT_TRACE_REFS=1 git refs migrate --ref-format=reftable' commands.\n\nSigned-off-by: Xinyu Ruan <r200981113@gmail.com>\n---\n    refs: add missing remove_on_disk implementation for debug backend\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2082%2FRuanXinyu%2Ffix-refs-trace-migrate-error-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2082/RuanXinyu/fix-refs-trace-migrate-error-v1\nPull-Request: https://github.com/git/git/pull/2082\n\n refs/debug.c | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/refs/debug.c b/refs/debug.c\nindex da300efaf3..dd49080836 100644\n--- a/refs/debug.c\n+++ b/refs/debug.c\n@@ -48,6 +48,14 @@ static int debug_create_on_disk(struct ref_store *refs, int flags, struct strbuf\n \treturn res;\n }\n \n+static int debug_remove_on_disk(struct ref_store *refs, struct strbuf *err)\n+{\n+\tstruct debug_ref_store *drefs = (struct debug_ref_store *)refs;\n+\tint res = drefs->refs->be->remove_on_disk(drefs->refs, err);\n+\ttrace_printf_key(&trace_refs, \"remove_on_disk: %d\\n\", res);\n+\treturn res;\n+}\n+\n static int debug_transaction_prepare(struct ref_store *refs,\n \t\t\t\t     struct ref_transaction *transaction,\n \t\t\t\t     struct strbuf *err)\n@@ -432,6 +440,7 @@ struct ref_storage_be refs_be_debug = {\n \t.init = NULL,\n \t.release = debug_release,\n \t.create_on_disk = debug_create_on_disk,\n+\t.remove_on_disk = debug_remove_on_disk,\n \n \t/*\n \t * None of these should be NULL. If the \"files\" backend (in\n\nbase-commit: 81f86aacc4eb74cdb9c2c8082d36d2070c666045\n-- \ngitgitgadget\n"},{"id":"529574","messageId":"aPtCvwvNUtFXqrpv@pks.im","threadId":"64377","inReplyTo":"pull.2082.git.git.1761295094982.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-10-24T09:11:27Z","receivedAt":"2025-10-24T09:11:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Oct 24, 2025 at 08:38:14AM +0000, RuanXinyu via GitGitGadget wrote:\n> From: RuanXinyu <r200981113@gmail.com>\n> \n> The debug ref backend (refs_be_debug) was missing the remove_on_disk\n> function pointer, which caused a segmentation fault when running\n> 'GIT_TRACE_REFS=1 git refs migrate --ref-format=reftable' commands.\n\nHeh, funny, just as I said nobody uses this infra you show up :) Good\nway to prove me wrong, thanks!\n\n> Signed-off-by: Xinyu Ruan <r200981113@gmail.com>\n\nTiny nit: typically, the author and DCO should match. But the autor is\n\"RuanXinyu\" whereas the DCO says \"Xinyu Ruan\". I don't really think that\nthis is something that warrants a new version, but I wanted to point\nthis out anyway so that you can fix this going forward.\n\n> diff --git a/refs/debug.c b/refs/debug.c\n> index da300efaf3..dd49080836 100644\n> --- a/refs/debug.c\n> +++ b/refs/debug.c\n> @@ -48,6 +48,14 @@ static int debug_create_on_disk(struct ref_store *refs, int flags, struct strbuf\n>  \treturn res;\n>  }\n>  \n> +static int debug_remove_on_disk(struct ref_store *refs, struct strbuf *err)\n> +{\n> +\tstruct debug_ref_store *drefs = (struct debug_ref_store *)refs;\n> +\tint res = drefs->refs->be->remove_on_disk(drefs->refs, err);\n> +\ttrace_printf_key(&trace_refs, \"remove_on_disk: %d\\n\", res);\n> +\treturn res;\n> +}\n> +\n>  static int debug_transaction_prepare(struct ref_store *refs,\n>  \t\t\t\t     struct ref_transaction *transaction,\n>  \t\t\t\t     struct strbuf *err)\n> @@ -432,6 +440,7 @@ struct ref_storage_be refs_be_debug = {\n>  \t.init = NULL,\n>  \t.release = debug_release,\n>  \t.create_on_disk = debug_create_on_disk,\n> +\t.remove_on_disk = debug_remove_on_disk,\n>  \n>  \t/*\n>  \t * None of these should be NULL. If the \"files\" backend (in\n\nYup, the implementation looks obviously correct to me. Thanks for fixing\nthis bug!\n\nPatrick\n"},{"id":"529607","messageId":"xmqqikg4qqn2.fsf@gitster.g","threadId":"64377","inReplyTo":"aPtCvwvNUtFXqrpv@pks.im","subject":"Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-10-24T15:13:37Z","receivedAt":"2025-10-24T15:13:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n>> Signed-off-by: Xinyu Ruan <r200981113@gmail.com>\n>\n> Tiny nit: typically, the author and DCO should match. But the autor is\n> \"RuanXinyu\" whereas the DCO says \"Xinyu Ruan\". I don't really think that\n> this is something that warrants a new version, but I wanted to point\n> this out anyway so that you can fix this going forward.\n\nIt may not warrant a new version in the sense that I could tweak\nwhile queuing, but I need to be told which between the two is the\nname to be used before doing so.\n\nI can make a guess and use the latter but it would cause me yet\nanother piece of extra work if I guessed incorrectly, so...\n"},{"id":"529687","messageId":"CANWnLjtWWOMtSKyB4275ZPZM65xkyNMnaF8u+v62tqgrOb_ByA@mail.gmail.com","threadId":"64377","inReplyTo":"xmqqikg4qqn2.fsf@gitster.g","subject":"Re: [PATCH] refs: add missing remove_on_disk implementation for debug backend","fromName":"阮新宇","fromEmail":"r200981113@gmail.com","sentAt":"2025-10-27T04:01:44Z","receivedAt":"2025-10-27T04:02:01Z","isPatch":true,"sender":{"key":"r200981113@gmail.com","avatar":null},"body":"On Fri, Oct 24, 2025 at 11:13 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Patrick Steinhardt <ps@pks.im> writes:\n>\n> >> Signed-off-by: Xinyu Ruan <r200981113@gmail.com>\n> >\n> > Tiny nit: typically, the author and DCO should match. But the autor is\n> > \"RuanXinyu\" whereas the DCO says \"Xinyu Ruan\". I don't really think that\n> > this is something that warrants a new version, but I wanted to point\n> > this out anyway so that you can fix this going forward.\n>\n> It may not warrant a new version in the sense that I could tweak\n> while queuing, but I need to be told which between the two is the\n> name to be used before doing so.\n>\n> I can make a guess and use the latter but it would cause me yet\n> another piece of extra work if I guessed incorrectly, so...\n\nPlease use \"Xinyu Ruan\" for both author and Signed-off-by.\nSorry for the confusion, and thanks for fixing it while queuing.\n"}]}