summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorLibravatar Derrick Stolee <dstolee@microsoft.com>2018-10-12 10:34:19 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-10-22 10:42:46 +0900
commit1dcd9f2043a38f0c9684d47c71b9e383942660ac (patch)
treeccc137d372ff6f1d4a6285f7448ac7f5e465eba3 /builtin/repack.c
parentmidx: fix broken free() in close_midx() (diff)
downloadtgif-1dcd9f2043a38f0c9684d47c71b9e383942660ac.tar.xz
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>
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index c6a7943d5c..44965cbaa3 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -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;
}