diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-01-26 15:40:29 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-01-26 15:40:29 -0800 |
commit | 3c809405cb35679dd5205bf0ea118b7ee9256abb (patch) | |
tree | a063a643dbcbf96f11018cdf2f379f00b764b238 | |
parent | eefc461ce3f2f0405639ff0919b844a894d6a02c (diff) | |
parent | d5621020c1e0edfa998cb5c5e80cdf47f36ffb1a (diff) | |
download | git-3c809405cb35679dd5205bf0ea118b7ee9256abb.tar.gz |
Merge branch 'js/close-packs-before-gc'
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
-rw-r--r-- | builtin/am.c | 1 | ||||
-rw-r--r-- | builtin/fetch.c | 2 | ||||
-rw-r--r-- | builtin/merge.c | 1 | ||||
-rw-r--r-- | builtin/receive-pack.c | 1 | ||||
-rwxr-xr-x | t/t5510-fetch.sh | 13 |
5 files changed, 18 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c index 9fb42fdd71..de235cf11a 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1939,6 +1939,7 @@ next: */ if (!state->rebasing) { am_destroy(state); + close_all_packs(); run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); } } diff --git a/builtin/fetch.c b/builtin/fetch.c index 33f04c1b4a..8e742135f0 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1225,6 +1225,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) 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 --git a/builtin/merge.c b/builtin/merge.c index 15bf95b3ac..b98a3489bf 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -404,6 +404,7 @@ static void finish(struct commit *head_commit, * We ignore errors in 'gc --auto', since the * user should see them. */ + close_all_packs(); run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); } } diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 2b3b746fb4..f2d6761af6 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1796,6 +1796,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) "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) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 47e68a597c..9203a6507f 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -708,4 +708,17 @@ test_expect_success 'fetching a one-level ref works' ' ) ' +test_expect_success 'fetching with auto-gc does not lock up' ' + write_script askyesno <<-\EOF && + echo "$*" && + false + EOF + git clone "file://$D" auto-gc && + test_commit test2 && + cd auto-gc && + git config gc.autoPackLimit 1 && + GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 && + ! grep "Should I try again" fetch.out +' + test_done |