Browse Source

[win-bootstrap] Use flag to enable direct install git

By default it's false and the bundled git is used.

Bug: b/379888465
Change-Id: I7d3d91da2ade6534d5b80479a050d6f608c16b2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6033861
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Anne Redulla <aredulla@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Anne Redulla 9 months ago
parent
commit
fbb90a5af2
1 changed files with 11 additions and 2 deletions
  1. 11 2
      bootstrap/bootstrap.py

+ 11 - 2
bootstrap/bootstrap.py

@@ -354,6 +354,11 @@ def main(argv):
     parser.add_argument('--bootstrap-name',
     parser.add_argument('--bootstrap-name',
                         required=True,
                         required=True,
                         help='The directory of the Python installation.')
                         help='The directory of the Python installation.')
+    parser.add_argument(
+        '--use-system-git',
+        action='store_true',
+        help='Whether to prefer a direct git installation over a depot_tools '
+        'bundled git.')
     args = parser.parse_args(argv)
     args = parser.parse_args(argv)
 
 
     logging.basicConfig(level=logging.DEBUG if args.verbose else logging.WARN)
     logging.basicConfig(level=logging.DEBUG if args.verbose else logging.WARN)
@@ -372,9 +377,13 @@ def main(argv):
         bootstrap_git_dir = os.path.join(bootstrap_dir, 'git')
         bootstrap_git_dir = os.path.join(bootstrap_dir, 'git')
         # Avoid messing with system git docs.
         # Avoid messing with system git docs.
         add_docs = False
         add_docs = False
-        git_dir = search_win_git_directory()
+        git_dir = None
+        if args.use_system_git:
+            git_dir = search_win_git_directory()
         if not git_dir:
         if not git_dir:
-            # git not found in PATH - fall back to depot_tools bundled git.
+            # Either using system git was not enabled
+            # or git was not found in PATH.
+            # Fall back to depot_tools bundled git.
             git_dir = bootstrap_git_dir
             git_dir = bootstrap_git_dir
             add_docs = True
             add_docs = True
         template = template._replace(GIT_BIN_ABSDIR=git_dir)
         template = template._replace(GIT_BIN_ABSDIR=git_dir)