Disable git's recurse submodule fetch

Git fetches submodules sequentially by default, which slows down gclient
sync. Instead of relying on git to fetch submodules, we can just
continue to rely on gclient to do the right thing.

R=jojwang@google.com

Bug: 1471702
Change-Id: Id0b104e76f702752bd7fecc7edac9245624bbb90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4766998
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/98/4766998/2
Josip Sokcevic 2 years ago committed by LUCI CQ
parent b3770b57c9
commit 84c0bbaf04

@ -580,12 +580,16 @@ class GitWrapper(SCMWrapper):
return_val = f(*args)
if os.path.exists(os.path.join(args[0].checkout_path, '.git')):
# If diff.ignoreSubmodules is not already set, set it to `all`.
currentIgnore = subprocess2.capture(
['git', 'config', '--get', 'diff.ignoreSubmodules'],
cwd=args[0].checkout_path).strip()
if not currentIgnore:
config = subprocess2.capture(
['git', 'config', '-l'],
cwd=args[0].checkout_path).decode('utf-8').strip().splitlines()
if 'diff.ignoresubmodules=all' not in config:
subprocess2.capture(['git', 'config', 'diff.ignoreSubmodules', 'all'],
cwd=args[0].checkout_path).strip()
if 'fetch.recursesubmodules=off' not in config:
subprocess2.capture(
['git', 'config', 'fetch.recurseSubmodules', 'off'],
cwd=args[0].checkout_path).strip()
return return_val
return wrapper

@ -413,6 +413,8 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
'a7142dc9f0009350b96a11f372b6ea658592aa95')
self.assertEqual(scm._Capture(['config', '--get', 'diff.ignoreSubmodules']),
'all')
self.assertEqual(
scm._Capture(['config', '--get', 'fetch.recurseSubmodules']), 'off')
sys.stdout.close()
def testUpdateMerge(self):

Loading…
Cancel
Save