git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] refs: cleanup code around optimization

From
Karthik Nayak <karthik.188@gmail.com>
Date
Oct 15, 2025, 21:25 UTC
Message-ID
<20251015-refs-code-cleanup-v1-2-550fdd8a3b41@gmail.com>
In-Reply-To
<20251015-refs-code-cleanup-v1-0-550fdd8a3b41@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.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 refs.c               | 6 ------
 refs.h               | 8 +-------
 refs/refs-internal.h | 3 ---
 3 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/refs.c b/refs.c
index a41a94ae55..b9a4a60646 100644
--- a/refs.c
+++ b/refs.c
@@ -2313,12 +2313,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 23437d1220..04e917fec0 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,12 +514,6 @@ 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.
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
Previous: Karthik NayakNext: Justin Tobler
Message 8 of 14 in “refs: cleanup code around optimizations”
  1. 0/4 refs: cleanup code around optimizationsKarthik Nayak, Oct 15, 2025
  2. 1/4 refs: move to using the '.optimize' functionsKarthik Nayak, Oct 15, 2025
  3. Justin ToblerOct 15, 2025
  4. Patrick SteinhardtOct 16, 2025
  5. Karthik NayakOct 16, 2025
  6. Patrick SteinhardtOct 16, 2025
  7. Karthik NayakOct 16, 2025
  8. 2/4 refs: cleanup code around optimizationKarthik Nayak, Oct 15, 2025
  9. Justin ToblerOct 15, 2025
  10. 3/4 refs: rename 'pack_refs_opts' to 'refs_optimize_opts'Karthik Nayak, Oct 15, 2025
  11. Justin ToblerOct 15, 2025
  12. Karthik NayakOct 16, 2025
  13. 4/4 t/pack-refs-tests: move the 'test_done' to calleesKarthik Nayak, Oct 15, 2025
  14. Patrick SteinhardtOct 16, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.