[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>
diff --git a/gclient_scm.py b/gclient_scm.py
index 781293d..602b81e 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -615,6 +615,14 @@
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