[gclient] Handle auth setup for cached repos

Bug: b/389733575
Change-Id: I3b65d380551cbc23746e285d082076514edebf5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6169811
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
Allen Li
2025-01-15 14:15:24 -08:00
committed by LUCI CQ
parent 7b9ced4220
commit da04081b69

View File

@@ -1369,7 +1369,11 @@ class GitWrapper(SCMWrapper):
# Set up Git authentication configuration that is needed to clone/fetch the repo.
if newauth.Enabled():
git_auth.ConfigureGlobal('/', url)
# We need the host from the URL to determine auth settings.
# The url parameter might have been re-written to a local
# cache directory, so we need self.url, which contains the
# original remote URL.
git_auth.ConfigureGlobal('/', self.url)
if hasattr(options, 'no_history') and options.no_history:
self._Run(['init', self.checkout_path], options, cwd=self._root_dir)