From: Karthik Nayak Date: Fri, 10 Oct 2025 10:27:06 GMT Subject: [PATCH 2/9] refs: cleanup code around optimization Message-ID: <20251010-562-add-option-to-check-if-reference-backend-needs-repacking-v1-2-c7962be584fa@gmail.com> In-Reply-To: <20251010-562-add-option-to-check-if-reference-backend-needs-repacking-v1-0-c7962be584fa@gmail.com> The previous commit, moved all backends to only use/support the 'optimize' function within the `ref_store` structure. With this, cleanup all references to the 'pack_refs' field of the structure and code around it. Modify existing documentation in this regard. Signed-off-by: Karthik Nayak --- refs.c | 6 ------ refs.h | 10 +++------- refs/refs-internal.h | 3 --- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/refs.c b/refs.c index 40acaa3f42..77dc1ab501 100644 --- a/refs.c +++ b/refs.c @@ -2312,12 +2312,6 @@ void base_ref_store_init(struct ref_store *refs, struct repository *repo, refs->gitdir = xstrdup(path); } -/* backend functions */ -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); diff --git a/refs.h b/refs.h index 2dd7ac1a16..c6c955d78d 100644 --- a/refs.h +++ b/refs.h @@ -499,7 +499,7 @@ void refs_warn_dangling_symrefs(struct ref_store *refs, FILE *fp, const struct string_list *refnames); /* - * Flags for controlling behaviour of pack_refs() + * Flags for controlling behaviour of refs_optimize() * PACK_REFS_PRUNE: Prune loose refs after packing * PACK_REFS_AUTO: Pack refs on a best effort basis. The heuristics and end * result are decided by the ref backend. Backends may ignore @@ -514,15 +514,11 @@ struct pack_refs_opts { struct string_list *includes; }; -/* - * Write a packed-refs file for the current repository. - * flags: Combination of the above PACK_REFS_* flags. - */ -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. + * + * flags: Combination of the above PACK_REFS_* flags. */ int refs_optimize(struct ref_store *refs, struct pack_refs_opts *opts); diff --git a/refs/refs-internal.h b/refs/refs-internal.h index 4671517dad..fc5149df5b 100644 --- a/refs/refs-internal.h +++ b/refs/refs-internal.h @@ -422,8 +422,6 @@ typedef int ref_transaction_commit_fn(struct ref_store *refs, struct ref_transaction *transaction, struct strbuf *err); -typedef int pack_refs_fn(struct ref_store *ref_store, - struct pack_refs_opts *opts); typedef int optimize_fn(struct ref_store *ref_store, struct pack_refs_opts *opts); typedef int rename_ref_fn(struct ref_store *ref_store, @@ -550,7 +548,6 @@ struct ref_storage_be { ref_transaction_finish_fn *transaction_finish; ref_transaction_abort_fn *transaction_abort; - pack_refs_fn *pack_refs; optimize_fn *optimize; rename_ref_fn *rename_ref; copy_ref_fn *copy_ref; -- 2.51.0