From 3b9212b7ee01b13d2f8fb9a41bc2639fd391df5c Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Mon, 18 Sep 2023 19:26:26 +0000 Subject: [PATCH] [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 Reviewed-by: Joanna Wang Commit-Queue: Josip Sokcevic --- gclient_scm.py | 8 ++++++++ tests/gclient_scm_test.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/gclient_scm.py b/gclient_scm.py index 781293d00..602b81e3e 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -615,6 +615,14 @@ class GitWrapper(SCMWrapper): subprocess2.capture( ['git', 'config', 'fetch.recurseSubmodules', 'off'], 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 wrapper diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index b6fa17990..c2004e3d5 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -423,6 +423,8 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): scm._Capture(['config', '--get', 'diff.ignoreSubmodules']), 'dirty') self.assertEqual( scm._Capture(['config', '--get', 'fetch.recurseSubmodules']), 'off') + self.assertEqual( + scm._Capture(['config', '--get', 'push.recurseSubmodules']), 'off') sys.stdout.close() def testUpdateMerge(self):