Skip to content

Commit 5104f8f

Browse files
committed
Merge branch 'js/gc-repack-close-before-remove'
"git gc" and "git repack" did not close the open packfiles that they found unneeded before removing them, which didn't work on a platform incapable of removing an open file. This has been corrected. * js/gc-repack-close-before-remove: gc/repack: release packs when needed
2 parents eab7584 + 5bdece0 commit 5104f8f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

builtin/gc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,10 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
659659

660660
report_garbage = report_pack_garbage;
661661
reprepare_packed_git(the_repository);
662-
if (pack_garbage.nr > 0)
662+
if (pack_garbage.nr > 0) {
663+
close_all_packs(the_repository->objects);
663664
clean_pack_garbage();
665+
}
664666

665667
if (gc_write_commit_graph)
666668
write_commit_graph_reachable(get_object_directory(), 0,

builtin/repack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
419419
if (!names.nr && !po_args.quiet)
420420
printf_ln(_("Nothing new to pack."));
421421

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

0 commit comments

Comments
 (0)