From: Junio C Hamano Date: Fri, 18 Jan 2019 21:49:57 +0000 (-0800) Subject: Merge branch 'js/gc-repack-close-before-remove' X-Git-Tag: v2.21.0-rc0~77 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5104f8f1acaecbe252cd0c561582052c12278b62 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 --- 5104f8f1acaecbe252cd0c561582052c12278b62 diff --cc builtin/gc.c index 7696017cd4,8a99ed2af2..020f725acc --- a/builtin/gc.c +++ b/builtin/gc.c @@@ -659,12 -642,13 +659,14 @@@ int cmd_gc(int argc, const char **argv 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); + write_commit_graph_reachable(get_object_directory(), 0, + !quiet && !daemonized); if (auto_gc && too_many_loose_objects()) warning(_("There are too many unreachable loose objects; " diff --cc builtin/repack.c index 2a1c7b21c5,2317608c6b..67f8978043 --- a/builtin/repack.c +++ b/builtin/repack.c @@@ -417,8 -406,10 +417,10 @@@ int cmd_repack(int argc, const char **a return ret; if (!names.nr && !po_args.quiet) - printf("Nothing new to pack.\n"); + printf_ln(_("Nothing new to pack.")); + close_all_packs(the_repository->objects); + /* * Ok we have prepared all new packfiles. * First see if there are packs of the same name and if so