[gclient_scm] Add new auth stack setup to gclient

Bug: b/356935829
Change-Id: Ie917f142c3fddba398a5351d685a7b131b298a76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5762791
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
Allen Li
2024-08-07 22:11:56 +00:00
committed by LUCI CQ
parent 5a05f6858c
commit a603aded9a
2 changed files with 26 additions and 0 deletions

View File

@@ -21,8 +21,10 @@ import traceback
import gclient_utils
import gerrit_util
import git_auth
import git_cache
import git_common
import newauth
import scm
import subprocess2
@@ -1321,6 +1323,10 @@ class GitWrapper(SCMWrapper):
parent_dir = os.path.dirname(self.checkout_path)
gclient_utils.safe_makedirs(parent_dir)
# Set up Git authentication configuration that is needed to clone/fetch the repo.
if newauth.Enabled():
git_auth.ConfigureGlobal('/', url)
if hasattr(options, 'no_history') and options.no_history:
self._Run(['init', self.checkout_path], options, cwd=self._root_dir)
self._Run(['remote', 'add', 'origin', url], options)