From: Junio C Hamano Date: Fri, 5 Feb 2016 22:54:13 +0000 (-0800) Subject: Merge branch 'js/close-packs-before-gc' into maint X-Git-Tag: v2.7.1~18 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f748e6916749e35fc54c24eb6e02e1182c62a052?hp=-c Merge branch 'js/close-packs-before-gc' into maint Many codepaths that run "gc --auto" before exiting kept packfiles mapped and left the file descriptors to them open, which was not friendly to systems that cannot remove files that are open. They now close the packs before doing so. * js/close-packs-before-gc: receive-pack: release pack files before garbage-collecting merge: release pack files before garbage-collecting am: release pack files before garbage-collecting fetch: release pack files before garbage-collecting --- f748e6916749e35fc54c24eb6e02e1182c62a052 diff --combined builtin/fetch.c index 9e24bb485f,5b58001a98..17f40e10f6 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@@ -837,7 -837,7 +837,7 @@@ static void check_not_current_branch(st static int truncate_fetch_head(void) { const char *filename = git_path_fetch_head(); - FILE *fp = fopen(filename, "w"); + FILE *fp = fopen_for_writing(filename); if (!fp) return error(_("cannot open %s: %s\n"), filename, strerror(errno)); @@@ -1221,6 -1221,8 +1221,8 @@@ int cmd_fetch(int argc, const char **ar list.strdup_strings = 1; string_list_clear(&list, 0); + close_all_packs(); + argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL); if (verbosity < 0) argv_array_push(&argv_gc_auto, "--quiet"); diff --combined builtin/receive-pack.c index 2b3b746fb4,b3104433ed..f2d6761af6 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@@ -1618,7 -1618,7 +1618,7 @@@ static void prepare_shallow_update(stru continue; si->need_reachability_test[i]++; for (k = 0; k < 32; k++) - if (si->used_shallow[i][j] & (1 << k)) + if (si->used_shallow[i][j] & (1U << k)) si->shallow_ref[j * 32 + k]++; } @@@ -1796,6 -1796,7 +1796,7 @@@ int cmd_receive_pack(int argc, const ch "gc", "--auto", "--quiet", NULL, }; int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR; + close_all_packs(); run_command_v_opt(argv_gc_auto, opt); } if (auto_update_server_info)