summaryrefslogtreecommitdiff
path: root/t/t5514-fetch-multiple.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-06-19 09:46:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-20 03:56:44 (GMT)
commitc3d6b70338d0ac93f66142873f1606277dbe589f (patch)
tree2ea41e30c1bc6f2ac70c89aebf088e3bb256ad3f /t/t5514-fetch-multiple.sh
parentb697d92f56511e804b8ba20ccbe7bdc85dc66810 (diff)
downloadgit-c3d6b70338d0ac93f66142873f1606277dbe589f.zip
git-c3d6b70338d0ac93f66142873f1606277dbe589f.tar.gz
git-c3d6b70338d0ac93f66142873f1606277dbe589f.tar.bz2
fetch: only run 'gc' once when fetching multiple remotes
In multiple remotes mode, git-fetch is launched for n-1 remotes and the last remote is handled by the current process. Each of these processes will in turn run 'gc' at the end. This is not really a problem because even if multiple 'gc --auto' is run at the same time we still handle it correctly. It does show multiple "auto packing in the background" messages though. And we may waste some resources when gc actually runs because we still do some stuff before checking the lock and moving it to background. So let's try to avoid that. We should only need one 'gc' run after all objects and references are added anyway. Add a new option --no-auto-gc that will be used by those n-1 processes. 'gc --auto' will always run on the main fetch process (*). (*) even if we fetch remotes in parallel at some point in future, this should still be fine because we should "join" all those processes before this step. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5514-fetch-multiple.sh')
-rwxr-xr-xt/t5514-fetch-multiple.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh
index 0030c92..5426d4b 100755
--- a/t/t5514-fetch-multiple.sh
+++ b/t/t5514-fetch-multiple.sh
@@ -105,9 +105,12 @@ test_expect_success 'git fetch --multiple (two remotes)' '
git remote rm origin &&
git remote add one ../one &&
git remote add two ../two &&
- git fetch --multiple one two &&
+ GIT_TRACE=1 git fetch --multiple one two 2>trace &&
git branch -r > output &&
- test_cmp ../expect output)
+ test_cmp ../expect output &&
+ grep "built-in: git gc" trace >gc &&
+ test_line_count = 1 gc
+ )
'
test_expect_success 'git fetch --multiple (bad remote names)' '