Sfoglia il codice sorgente

[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>
Josip Sokcevic 1 anno fa
parent
commit
3b9212b7ee
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 8 0
      gclient_scm.py
  2. 2 0
      tests/gclient_scm_test.py

+ 8 - 0
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

+ 2 - 0
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):