Skip to content

Commit d3594a2

Browse files
committed
gc/repack: release packs when needed
On Windows, files cannot be removed nor renamed if there are still handles held by a process. To remedy that, we introduced the close_all_packs() function. Earlier, we made sure that the packs are released just before `git gc` is spawned, in case that gc wants to remove no-longer needed packs. But this developer forgot that gc itself also needs to let go of packs, e.g. when consolidating all packs via the --aggressive option. Likewise, `git repack -d` wants to delete obsolete packs and therefore needs to close all pack handles, too. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7dcd3d8 commit d3594a2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/repack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
421421

422422
close_all_packs(the_repository->objects);
423423

424+
close_all_packs(the_repository->objects);
425+
424426
/*
425427
* Ok we have prepared all new packfiles.
426428
* First see if there are packs of the same name and if so

0 commit comments

Comments
 (0)