]> git.ipfire.org Git - thirdparty/git.git/commitdiff
midx.c: lookup MIDX by object directory during repack
authorTaylor Blau <me@ttaylorr.com>
Fri, 8 Oct 2021 21:46:35 +0000 (17:46 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Oct 2021 20:08:11 +0000 (13:08 -0700)
Apply similar treatment as in the last commit to the MIDX `repack`
operation.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c

diff --git a/midx.c b/midx.c
index 053279bef352316a19769308646e1bdd57247a82..f2c976051de8c72a9e218ab189f3c597dcb9d384 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -1861,7 +1861,7 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
        struct child_process cmd = CHILD_PROCESS_INIT;
        FILE *cmd_in;
        struct strbuf base_name = STRBUF_INIT;
-       struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
+       struct multi_pack_index *m = lookup_multi_pack_index(r, object_dir);
 
        /*
         * When updating the default for these configuration
@@ -1933,11 +1933,8 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
        }
 
        result = write_midx_internal(object_dir, NULL, NULL, NULL, NULL, flags);
-       m = NULL;
 
 cleanup:
-       if (m)
-               close_midx(m);
        free(include_pack);
        return result;
 }