]> git.ipfire.org Git - thirdparty/git.git/commit
repack: keep track of MIDX pack names using existing_packs
authorTaylor Blau <me@ttaylorr.com>
Wed, 15 Oct 2025 22:28:59 +0000 (18:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Oct 2025 17:08:55 +0000 (10:08 -0700)
commit2fee63a71ae8113fd91d8e5924ae4a5619ad0cd3
tree043efeb9fa7032bf1179080251bfb2bf976a6f8f
parentc3690c97d7b08d9876fcaf0a572b4956bc9b4c33
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>
builtin/repack.c
repack.c
repack.h