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

[PATCH 4/5] repack-promisor: extract function to remove redundant packs

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 5, 2026, 13:16 UTC
Message-ID
<20260105-pks-geometric-repack-with-promisors-v1-4-c4660573437e@pks.im>
In-Reply-To
<20260105-pks-geometric-repack-with-promisors-v1-0-c4660573437e@pks.im>

We're about to add a second caller that wants to remove redundant packs after a geometric repack. Split out the function which does this to prepare for that.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 repack-geometry.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/repack-geometry.c b/repack-geometry.c
index 17e6652a91..0daf545a81 100644
--- a/repack-geometry.c
+++ b/repack-geometry.c
@@ -197,17 +197,18 @@ struct packed_git *pack_geometry_preferred_pack(struct pack_geometry *geometry)
 	return NULL;
 }
 
-void pack_geometry_remove_redundant(struct pack_geometry *geometry,
-				    struct string_list *names,
-				    struct existing_packs *existing,
-				    const char *packdir)
+static void remove_redundant_packs(struct packed_git **pack,
+				   uint32_t pack_nr,
+				   struct string_list *names,
+				   struct existing_packs *existing,
+				   const char *packdir)
 {
 	const struct git_hash_algo *algop = existing->repo->hash_algo;
 	struct strbuf buf = STRBUF_INIT;
 	uint32_t i;
 
-	for (i = 0; i < geometry->split; i++) {
-		struct packed_git *p = geometry->pack[i];
+	for (i = 0; i < pack_nr; i++) {
+		struct packed_git *p = pack[i];
 		if (string_list_has_string(names, hash_to_hex_algop(p->hash,
 								    algop)))
 			continue;
@@ -226,6 +227,15 @@ void pack_geometry_remove_redundant(struct pack_geometry *geometry,
 	strbuf_release(&buf);
 }
 
+void pack_geometry_remove_redundant(struct pack_geometry *geometry,
+				    struct string_list *names,
+				    struct existing_packs *existing,
+				    const char *packdir)
+{
+	remove_redundant_packs(geometry->pack, geometry->split,
+			       names, existing, packdir);
+}
+
 void pack_geometry_release(struct pack_geometry *geometry)
 {
 	if (!geometry)
-- 
2.52.0.508.g883dcfc63e.dirty
Previous: Patrick SteinhardtNext: Taylor Blau
Message 8 of 11 in “builtin/repack: make geometric repacking compatible with promisors”
  1. 0/5 builtin/repack: make geometric repacking compatible with promisorsPatrick Steinhardt, Jan 5, 2026
  2. 1/5 builtin/pack-objects: exclude promisor objects with "--stdin-packs"Patrick Steinhardt, Jan 5, 2026
  3. Taylor BlauJan 9, 2026
  4. Patrick SteinhardtJan 12, 2026
  5. 2/5 repack-geometry: extract function to compute repacking splitPatrick Steinhardt, Jan 5, 2026
  6. Toon ClaesJan 14, 2026
  7. 3/5 repack-promisor: extract function to finalize repackingPatrick Steinhardt, Jan 5, 2026
  8. 4/5 repack-promisor: extract function to remove redundant packsPatrick Steinhardt, Jan 5, 2026
  9. Taylor BlauJan 9, 2026
  10. 5/5 builtin/repack: handle promisor packs with geometric repackingPatrick Steinhardt, Jan 5, 2026
  11. Toon ClaesJan 14, 2026

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.