repack: fix generating multi-pack-index with only non-local packs
commit51861340f8d7f76a99e0d7265f4417b0a9a6871c
authorPatrick Steinhardt <ps@pks.im>
Fri, 14 Apr 2023 06:01:40 +0000 (14 08:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Apr 2023 17:27:51 +0000 (14 10:27 -0700)
tree764b70c21b4233e029f532f1046b42695b718215
parent3d74a2337c679839265efa16b2bca2a9b7795a00
repack: fix generating multi-pack-index with only non-local packs

When writing the multi-pack-index with geometric repacking we will add
all packfiles to the index that are part of the geometric sequence. This
can potentially also include packfiles borrowed from an alternate object
directory. But given that a multi-pack-index can only ever include packs
that are part of the main object database this does not make much sense
whatsoever.

In the edge case where all packfiles are contained in the alternate
object database and the local repository has none itself this bug can
cause us to invoke git-multi-pack-index(1) with only non-local packfiles
that it ultimately cannot find. This causes it to return an error and
thus causes the geometric repack to fail.

Fix the code to skip non-local packfiles.

Co-authored-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c
t/t7703-repack-geometric.sh