Disabled threaded index-pack for known difficult repositories.

BUG=349576
R=mmoss@google.com

Review URL: https://codereview.chromium.org/210063005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@259164 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 44dba57..3517946 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -30,6 +30,14 @@
 _WARNINGS = []
 
 
+# These repos are known to cause OOM errors on 32-bit platforms, due the the
+# very large objects they contain.  It is not safe to use threaded index-pack
+# when cloning/fetching them.
+THREADED_INDEX_PACK_BLACKLIST = [
+  'https://chromium.googlesource.com/chromium/reference_builds/chrome_win.git'
+]
+
+
 class Error(Exception):
   """gclient exception class."""
   def __init__(self, msg, *args, **kwargs):
@@ -990,10 +998,13 @@
   else:
     return '512m'
 
-def DefaultIndexPackConfig():
+def DefaultIndexPackConfig(url=''):
   """Return reasonable default values for configuring git-index-pack.
 
   Experiments suggest that higher values for pack.threads don't improve
   performance."""
-  return ['-c', 'pack.threads=5', '-c',
-          'core.deltaBaseCacheLimit=%s' % DefaultDeltaBaseCacheLimit()]
+  cache_limit = DefaultDeltaBaseCacheLimit()
+  result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
+  if url in THREADED_INDEX_PACK_BLACKLIST:
+    result.extend(['-c', 'pack.threads=1'])
+  return result