mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Fix caching Gerrit account presence outside of repos
This fixes the case where a user tries to fetch new repos but isn't in a Git directory (probably true for most people if they don't have, e.g., their home directory as a Git repo). There are a couple of ways to bikeshed a solution for this, but the most straightforward/easiest is to skip since we're just caching the account presence check. Bug: b/328682976 Change-Id: I87a0b210451e6952839eef73616d012c41ad300f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6154836 Commit-Queue: Allen Li <ayatane@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
@@ -910,7 +910,18 @@ class GitCredsAuthenticator(_Authenticator):
|
||||
LOGGER.debug("Gerrit account does not exist on %r", host)
|
||||
return False
|
||||
LOGGER.debug("Gerrit account exists on %r", host)
|
||||
scm.GIT.SetConfig(cwd, 'depot-tools.hostHasAccount', host, append=True)
|
||||
try:
|
||||
scm.GIT.SetConfig(cwd,
|
||||
'depot-tools.hostHasAccount',
|
||||
host,
|
||||
append=True)
|
||||
except subprocess2.CalledProcessError as e:
|
||||
# This may be called outside of a Git repository (e.g., when
|
||||
# fetching from scratch), in which case we don't have a Git
|
||||
# repository to cache the results of our check, so skip the
|
||||
# caching.
|
||||
LOGGER.debug(
|
||||
"Got error trying to cache 'depot-tools.hostHasAccount': %s", e)
|
||||
return True
|
||||
|
||||
def is_applicable(self, *, conn: Optional[HttpConn] = None):
|
||||
|
||||
Reference in New Issue
Block a user