aboutsummaryrefslogtreecommitdiffstats
path: root/refs/debug.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2025-10-20 10:18:29 +0200
committerJunio C Hamano <gitster@pobox.com>2025-11-04 07:35:12 -0800
commit9b93ab8a9c61c53b3b9b2b3ba60c3e5d66b8ff56 (patch)
tree5c551a30e3019473e8a8fd3d9980c5fd35db7d66 /refs/debug.c
parentaec5adb4b70e1fa58d4a7cfc3fb07913733f7e90 (diff)
downloadgit-9b93ab8a9c61c53b3b9b2b3ba60c3e5d66b8ff56.tar.gz
refs: move to using the '.optimize' functions
The `struct ref_store` variable exposes two ways to optimize a reftable backend: 1. pack_refs 2. optimize The former was specific to the 'files' + 'packed' refs backend. The latter is more generic and covers all backends. While the naming is different, both of these functions perform the same functionality. Consolidate this code to only maintain the 'optimize' functions. Do this by modifying the backends so that they exclusively implement the `optimize` callback, only. All users of the refs subsystem already use the 'optimize' function so there is no changes needed on the callee side. Finally, cleanup all references to the 'pack_refs' field of the structure and code around it. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/debug.c')
-rw-r--r--refs/debug.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/refs/debug.c b/refs/debug.c
index 01499b9033..40cd1d9c15 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -116,11 +116,11 @@ static int debug_transaction_abort(struct ref_store *refs,
return res;
}
-static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *opts)
+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->pack_refs(drefs->refs, opts);
- trace_printf_key(&trace_refs, "pack_refs: %d\n", res);
+ int res = drefs->refs->be->optimize(drefs->refs, opts);
+ trace_printf_key(&trace_refs, "optimize: %d\n", res);
return res;
}
@@ -430,7 +430,7 @@ struct ref_storage_be refs_be_debug = {
.transaction_finish = debug_transaction_finish,
.transaction_abort = debug_transaction_abort,
- .pack_refs = debug_pack_refs,
+ .optimize = debug_optimize,
.rename_ref = debug_rename_ref,
.copy_ref = debug_copy_ref,