aboutsummaryrefslogtreecommitdiff
path: root/repack.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-10-15 18:28:59 -0400
committerJunio C Hamano <gitster@pobox.com>2025-10-16 10:08:55 -0700
commit2fee63a71ae8113fd91d8e5924ae4a5619ad0cd3 (patch)
tree043efeb9fa7032bf1179080251bfb2bf976a6f8f /repack.c
parentc3690c97d7b08d9876fcaf0a572b4956bc9b4c33 (diff)
downloadgit-2fee63a71ae8113fd91d8e5924ae4a5619ad0cd3.tar.xz
repack: keep track of MIDX pack names using existing_packs
Instead of storing the list of MIDX pack names separately, let's inline it into the existing_packs struct, further reducing the number of parameters we have to pass around. This amounts to adding a new string_list to the existing_packs struct, and populating it via `existing_packs_collect()`. This is fairly straightforward to do, since we are already looping over all packs, all we need to do is: if (p->multi_pack_index) string_list_append(&existing->midx_packs, pack_basename(p)); Note, however, that this check *must* come before other conditions where we discard and do not keep track of a pack, including the condition "if (!p->pack_local)" immediately below. This is because the existing routine which collects MIDX pack names does so blindly, and does not discard, for example, non-local packs. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repack.c')
-rw-r--r--repack.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/repack.c b/repack.c
index d8afdd352d..1d485e0112 100644
--- a/repack.c
+++ b/repack.c
@@ -80,6 +80,9 @@ void existing_packs_collect(struct existing_packs *existing,
size_t i;
const char *base;
+ if (p->multi_pack_index)
+ string_list_append(&existing->midx_packs,
+ pack_basename(p));
if (!p->pack_local)
continue;
@@ -104,6 +107,7 @@ void existing_packs_collect(struct existing_packs *existing,
string_list_sort(&existing->kept_packs);
string_list_sort(&existing->non_kept_packs);
string_list_sort(&existing->cruft_packs);
+ string_list_sort(&existing->midx_packs);
strbuf_release(&buf);
}
@@ -220,6 +224,7 @@ void existing_packs_release(struct existing_packs *existing)
string_list_clear(&existing->kept_packs, 0);
string_list_clear(&existing->non_kept_packs, 0);
string_list_clear(&existing->cruft_packs, 0);
+ string_list_clear(&existing->midx_packs, 0);
}
static struct {