gc/repack: release packs when needed
[gitweb.git] / builtin / gc.c
index 57069442b0dc1297366e29b1fbf0e6ee70377146..8a99ed2af2ba341af037224cd529dbfd031ac222 100644 (file)
@@ -642,8 +642,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 
        report_garbage = report_pack_garbage;
        reprepare_packed_git(the_repository);
-       if (pack_garbage.nr > 0)
+       if (pack_garbage.nr > 0) {
+               close_all_packs(the_repository->objects);
                clean_pack_garbage();
+       }
 
        if (gc_write_commit_graph)
                write_commit_graph_reachable(get_object_directory(), 0);