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>
This commit is contained in:
committed by
Junio C Hamano
parent
3d74a2337c
commit
51861340f8
@@ -570,6 +570,17 @@ static void midx_included_packs(struct string_list *include,
|
||||
for (i = geometry->split; i < geometry->pack_nr; i++) {
|
||||
struct packed_git *p = geometry->pack[i];
|
||||
|
||||
/*
|
||||
* The multi-pack index never refers to packfiles part
|
||||
* of an alternate object database, so we skip these.
|
||||
* While git-multi-pack-index(1) would silently ignore
|
||||
* them anyway, this allows us to skip executing the
|
||||
* command completely when we have only non-local
|
||||
* packfiles.
|
||||
*/
|
||||
if (!p->pack_local)
|
||||
continue;
|
||||
|
||||
strbuf_addstr(&buf, pack_basename(p));
|
||||
strbuf_strip_suffix(&buf, ".pack");
|
||||
strbuf_addstr(&buf, ".idx");
|
||||
|
||||
Reference in New Issue
Block a user