From: "Xinyu Ruan via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Xinyu Ruan <r200981113@gmail.com>, Xinyu Ruan <r200981113@gmail.com>
Subject: [PATCH] refs: add missing optimize implementation for debug ref backend
Date: Fri, 31 Oct 2025 03:37:39 +0000 [thread overview]
Message-ID: <pull.2090.git.git.1761881859881.gitgitgadget@gmail.com> (raw)
From: Xinyu Ruan <r200981113@gmail.com>
The debug ref backend (refs_be_debug) was missing the optimize
function pointer, which caused a segmentation fault when running
'GIT_TRACE_REFS=1 git pack-refs --all' command.
Signed-off-by: Xinyu Ruan <r200981113@gmail.com>
---
refs: add missing optimize implementation for debug ref backend
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2090%2FRuanXinyu%2Fref-debug-optimize-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2090/RuanXinyu/ref-debug-optimize-v1
Pull-Request: https://github.com/git/git/pull/2090
refs/debug.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/refs/debug.c b/refs/debug.c
index 697adbd0dc..8dad7046cd 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -124,6 +124,14 @@ static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *o
return res;
}
+static int debug_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)
+{
+ struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
+ int res = drefs->refs->be->optimize(drefs->refs, opts);
+ trace_printf_key(&trace_refs, "optimize: %d\n", res);
+ return res;
+}
+
static int debug_rename_ref(struct ref_store *ref_store, const char *oldref,
const char *newref, const char *logmsg)
{
@@ -444,6 +452,7 @@ struct ref_storage_be refs_be_debug = {
.transaction_abort = debug_transaction_abort,
.pack_refs = debug_pack_refs,
+ .optimize = debug_optimize,
.rename_ref = debug_rename_ref,
.copy_ref = debug_copy_ref,
base-commit: a99f379adf116d53eb11957af5bab5214915f91d
--
gitgitgadget
next reply other threads:[~2025-10-31 3:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 3:37 Xinyu Ruan via GitGitGadget [this message]
2025-10-31 6:39 ` [PATCH] refs: add missing optimize implementation for debug ref backend Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.2090.git.git.1761881859881.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=r200981113@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).