aboutsummaryrefslogtreecommitdiffstats
path: root/refs.h
diff options
context:
space:
mode:
authorMeet Soni <meetsoni3017@gmail.com>2025-09-19 13:56:39 +0530
committerJunio C Hamano <gitster@pobox.com>2025-09-19 10:02:55 -0700
commit8dfe077fb68eb952464ce59deaa4dfdd52891457 (patch)
tree9d14c9fcf9ef8548f0ba0a682405d5918b3230ba /refs.h
parentf814da676ae46aac5be0a98b99373a76dee6cedb (diff)
downloadgit-8dfe077fb68eb952464ce59deaa4dfdd52891457.tar.gz
refs: add a generic 'optimize' API
The existing `pack-refs` API is conceptually tied to the 'files' backend, but its behavior is generic (e.g., it triggers compaction for reftable). This naming is confusing. Introduce a new generic refs_optimize() API that dispatches to a backend-specific implementation via a new 'optimize' vtable method. This lays the architectural groundwork for different reference backends (like 'files' and 'reftable') to provide their own storage optimization logic, which will be called from a single, generic entry point. Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Meet Soni <meetsoni3017@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index f29e486e33..d28c4ef0af 100644
--- a/refs.h
+++ b/refs.h
@@ -481,6 +481,12 @@ struct pack_refs_opts {
int refs_pack_refs(struct ref_store *refs, struct pack_refs_opts *opts);
/*
+ * Optimize the ref store. The exact behavior is up to the backend.
+ * For the files backend, this is equivalent to packing refs.
+ */
+int refs_optimize(struct ref_store *refs, struct pack_refs_opts *opts);
+
+/*
* Setup reflog before using. Fill in err and return -1 on failure.
*/
int refs_create_reflog(struct ref_store *refs, const char *refname,