summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2012-10-31 12:24:38 -0700
committerDave Borowitz <dborowitz@google.com>2012-10-31 12:27:17 -0700
commite21526754be58523c673d29731ee01d80e0ffc31 (patch)
treeda87019198b421827c9e3cbaecce88077fb76caa
parent1d947b30342163b723c96db563967323535fef45 (diff)
downloadgit-repo-e21526754be58523c673d29731ee01d80e0ffc31.tar.gz
sync: Only parallelize gc for git >= 1.7.2
This minimum version is required for the -c argument to set config on the command line. Without this option, git by default uses as many threads per invocation as there are CPUs, so we cannot safely parallelize without hosing a system. Change-Id: I8fd313dd84917658162b5134b2d9aa34a96f2772
-rw-r--r--subcmds/sync.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 8e9477a3..15f69f7b 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -44,7 +44,7 @@ try:
44except ImportError: 44except ImportError:
45 multiprocessing = None 45 multiprocessing = None
46 46
47from git_command import GIT 47from git_command import GIT, git_require
48from git_refs import R_HEADS, HEAD 48from git_refs import R_HEADS, HEAD
49from main import WrapperModule 49from main import WrapperModule
50from project import Project 50from project import Project
@@ -310,7 +310,8 @@ later is required to fix a server side protocol bug.
310 return fetched 310 return fetched
311 311
312 def _GCProjects(self, projects): 312 def _GCProjects(self, projects):
313 if multiprocessing: 313 has_dash_c = git_require((1, 7, 2))
314 if multiprocessing and has_dash_c:
314 cpu_count = multiprocessing.cpu_count() 315 cpu_count = multiprocessing.cpu_count()
315 else: 316 else:
316 cpu_count = 1 317 cpu_count = 1