Skip to content

Commit 4a7fe71

Browse files
jeffhostetlerdscho
authored andcommitted
midx: verify: add midx packfiles to the packed_git list
Fix "git multi-pack-index verify" to handle repos with thousands of packfiles. Midx verify adds the individual "packed_git" structures to the multi_pack_index.packs array, but it does not add them to the "repository.objects.packed_git" list. During the verification code, each packfile is opened and scanned. And "pack_open_fds" is incremented. If "pack_open_fds" equals the "pack_max_fds" open_packed_git_1() calls close_one_pack() to LRU-style close an already open packfile. But because the packfiles were never added to the "packed_git" list, close_one_pack() does nothing. If there are very many packfiles, Git runs out of file descriptors and fails. Note that this was observed on Windows when build with GCC and in a repository with more than (2048-25) packfiles. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
1 parent 5e99cbd commit 4a7fe71

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

midx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,9 @@ int verify_midx_file(const char *object_dir)
10141014
for (i = 0; i < m->num_packs; i++) {
10151015
if (prepare_midx_pack(m, i))
10161016
midx_report("failed to load pack in position %d", i);
1017+
1018+
if (m->packs[i])
1019+
install_packed_git(the_repository, m->packs[i]);
10171020
}
10181021

10191022
for (i = 0; i < 255; i++) {

0 commit comments

Comments
 (0)