midx: close multi-pack-index on repack
When repacking, we may remove pack-files. This invalidates the multi-pack-index (if it exists). Previously, we removed the multi-pack-index file before removing any pack-file. In some cases, the repack command may load the multi-pack-index into memory. This may lead to later in-memory references to the non-existent pack- files. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0ce4ff9421
commit
1dcd9f2043
@ -431,8 +431,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||
char *fname, *fname_old;
|
||||
|
||||
if (!midx_cleared) {
|
||||
/* if we move a packfile, it will invalidated the midx */
|
||||
clear_midx_file(get_object_directory());
|
||||
clear_midx_file(the_repository);
|
||||
midx_cleared = 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user