mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
f814da676a
commit
8dfe077fb6
5
refs.c
5
refs.c
@@ -2282,6 +2282,11 @@ int refs_pack_refs(struct ref_store *refs, struct pack_refs_opts *opts)
|
||||
return refs->be->pack_refs(refs, opts);
|
||||
}
|
||||
|
||||
int refs_optimize(struct ref_store *refs, struct pack_refs_opts *opts)
|
||||
{
|
||||
return refs->be->optimize(refs, opts);
|
||||
}
|
||||
|
||||
int peel_iterated_oid(struct repository *r, const struct object_id *base, struct object_id *peeled)
|
||||
{
|
||||
if (current_ref_iter &&
|
||||
|
||||
Reference in New Issue
Block a user