Skip to content

Commit 17326cf

Browse files
committed
refs: add missing optimize implementation for debug ref backend
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>
1 parent a99f379 commit 17326cf

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

refs/debug.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *o
124124
return res;
125125
}
126126

127+
static int debug_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)
128+
{
129+
struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
130+
int res = drefs->refs->be->optimize(drefs->refs, opts);
131+
trace_printf_key(&trace_refs, "optimize: %d\n", res);
132+
return res;
133+
}
134+
127135
static int debug_rename_ref(struct ref_store *ref_store, const char *oldref,
128136
const char *newref, const char *logmsg)
129137
{
@@ -444,6 +452,7 @@ struct ref_storage_be refs_be_debug = {
444452
.transaction_abort = debug_transaction_abort,
445453

446454
.pack_refs = debug_pack_refs,
455+
.optimize = debug_optimize,
447456
.rename_ref = debug_rename_ref,
448457
.copy_ref = debug_copy_ref,
449458

0 commit comments

Comments
 (0)