[gclient_scm] Disable push recurseSubmodule

This option can lead to high `git cl upload` latency. We never want to
use this option for gclient managed repositories anyways since changes
need to go through code review.

Note: the default value is off, but it will be set to on if
`submodule.recurse` is set to true.

R=jojwang@google.com

Bug: b/299969165
Change-Id: I2173a2d96d478bf96bfe6e78ef0c5b21d4ac8015
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4874177
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/77/4874177/2
Josip Sokcevic 2 years ago committed by LUCI CQ
parent 8a25998dd9
commit 3b9212b7ee

@ -615,6 +615,14 @@ class GitWrapper(SCMWrapper):
subprocess2.capture( subprocess2.capture(
['git', 'config', 'fetch.recurseSubmodules', 'off'], ['git', 'config', 'fetch.recurseSubmodules', 'off'],
cwd=args[0].checkout_path) cwd=args[0].checkout_path)
if 'push.recursesubmodules=off' not in config:
# The default is off, but if user sets submodules.recurse to
# on, this becomes on too. We never want to push submodules
# for gclient managed repositories. Push, even if a no-op,
# will increase `git cl upload` latency.
subprocess2.capture(
['git', 'config', 'push.recurseSubmodules', 'off'],
cwd=args[0].checkout_path)
return return_val return return_val
return wrapper return wrapper

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

Loading…
Cancel
Save