multi-pack-index: define GIT_TEST_MULTI_PACK_INDEX
[gitweb.git] / builtin / repack.c
index c6a7943d5cb108dbccdfd502d799ab71a9e7e146..26dcccdafc5b8054f903a838d379a3a23dbc8b39 100644 (file)
@@ -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;
                        }
 
@@ -554,6 +553,10 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        if (!no_update_server_info)
                update_server_info(0);
        remove_temporary_files();
+
+       if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0))
+               write_midx_file(get_object_directory());
+
        string_list_clear(&names, 0);
        string_list_clear(&rollback, 0);
        string_list_clear(&existing_packs, 0);