{"thread":{"id":"64408","subject":"[PATCH] refs: add missing optimize implementation for debug ref backend","startedAt":"2025-10-31T03:37:42Z","lastAt":"2025-10-31T06:39:13Z","messageCount":2,"participants":["Xinyu Ruan via GitGitGadget","Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"529998","messageId":"pull.2090.git.git.1761881859881.gitgitgadget@gmail.com","threadId":"64408","inReplyTo":null,"subject":"[PATCH] refs: add missing optimize implementation for debug ref backend","fromName":"Xinyu Ruan via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-10-31T03:37:39Z","receivedAt":"2025-10-31T03:37:42Z","isPatch":true,"sender":{"key":"name:Xinyu Ruan","avatar":null},"body":"From: Xinyu Ruan <r200981113@gmail.com>\n\nThe debug ref backend (refs_be_debug) was missing the optimize\nfunction pointer, which caused a segmentation fault when running\n'GIT_TRACE_REFS=1 git pack-refs --all' command.\n\nSigned-off-by: Xinyu Ruan <r200981113@gmail.com>\n---\n    refs: add missing optimize implementation for debug ref backend\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2090%2FRuanXinyu%2Fref-debug-optimize-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2090/RuanXinyu/ref-debug-optimize-v1\nPull-Request: https://github.com/git/git/pull/2090\n\n refs/debug.c | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/refs/debug.c b/refs/debug.c\nindex 697adbd0dc..8dad7046cd 100644\n--- a/refs/debug.c\n+++ b/refs/debug.c\n@@ -124,6 +124,14 @@ static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *o\n \treturn res;\n }\n \n+static int debug_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)\n+{\n+\tstruct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;\n+\tint res = drefs->refs->be->optimize(drefs->refs, opts);\n+\ttrace_printf_key(&trace_refs, \"optimize: %d\\n\", res);\n+\treturn res;\n+}\n+\n static int debug_rename_ref(struct ref_store *ref_store, const char *oldref,\n \t\t\t    const char *newref, const char *logmsg)\n {\n@@ -444,6 +452,7 @@ struct ref_storage_be refs_be_debug = {\n \t.transaction_abort = debug_transaction_abort,\n \n \t.pack_refs = debug_pack_refs,\n+\t.optimize = debug_optimize,\n \t.rename_ref = debug_rename_ref,\n \t.copy_ref = debug_copy_ref,\n \n\nbase-commit: a99f379adf116d53eb11957af5bab5214915f91d\n-- \ngitgitgadget\n"},{"id":"530015","messageId":"aQRZizsobXECzvJI@pks.im","threadId":"64408","inReplyTo":"pull.2090.git.git.1761881859881.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: add missing optimize implementation for debug ref backend","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-10-31T06:39:07Z","receivedAt":"2025-10-31T06:39:13Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Oct 31, 2025 at 03:37:39AM +0000, Xinyu Ruan via GitGitGadget wrote:\n> From: Xinyu Ruan <r200981113@gmail.com>\n> \n> The debug ref backend (refs_be_debug) was missing the optimize\n> function pointer, which caused a segmentation fault when running\n> 'GIT_TRACE_REFS=1 git pack-refs --all' command.\n\nThanks for sending the patch! As far as I can see though it's redundant\nwith Karthik's patch series that is currently cooking in 'seen' [1]. So\nonce that's merged down we should be good.\n\nPatrick\n\n[1]: <20251020-refs-code-cleanup-v2-1-f5349ed0f6a5@gmail.com>\n"}]}