mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
[git_auth] Fix some bugs introduced during refactoring.
R=ayatane, dlf Change-Id: I11371375b7f02e9ed5b67cde79ee05da6b0ba5c1 Bug: 351071334 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5740607 Commit-Queue: Allen Li <ayatane@chromium.org> Reviewed-by: Dan Le Febvre <dlf@google.com> Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
This commit is contained in:
11
git_cl.py
11
git_cl.py
@@ -3671,14 +3671,16 @@ def ConfigureGitAuth() -> None:
|
||||
logging.debug('Configuring Git authentication...')
|
||||
|
||||
logging.debug('Configuring global Git authentication...')
|
||||
cl = Changelist()
|
||||
|
||||
# We want the user's global config.
|
||||
# We can probably assume the root directory doesn't have any local
|
||||
# Git configuration.
|
||||
c = git_auth.ConfigChanger.new_from_env('/')
|
||||
c = git_auth.ConfigChanger.new_from_env('/', cl)
|
||||
c.apply_global(os.path.expanduser('~'))
|
||||
|
||||
cwd = os.getcwd()
|
||||
c2 = git_auth.ConfigChanger.new_from_env(cwd)
|
||||
c2 = git_auth.ConfigChanger.new_from_env(cwd, cl)
|
||||
if c2.mode == c.mode:
|
||||
logging.debug(
|
||||
'Local user wants same mode %s as global; clearing local repo auth config',
|
||||
@@ -3696,14 +3698,15 @@ def ConfigureGitRepoAuth() -> None:
|
||||
"""Configure the current Git repo authentication."""
|
||||
logging.debug('Configuring current Git repo authentication...')
|
||||
cwd = os.getcwd()
|
||||
c = git_auth.ConfigChanger.new_from_env(cwd)
|
||||
c = git_auth.ConfigChanger.new_from_env(cwd, Changelist())
|
||||
c.apply(cwd)
|
||||
|
||||
|
||||
def ClearGitRepoAuth() -> None:
|
||||
"""Clear the current Git repo authentication."""
|
||||
logging.debug('Clearing current Git repo authentication...')
|
||||
c = git_auth.ConfigChanger.new_from_env(cwd)
|
||||
cwd = os.getcwd()
|
||||
c = git_auth.ConfigChanger.new_from_env(cwd, Changelist())
|
||||
c.mode = git_auth.ConfigMode.NO_AUTH
|
||||
c.apply(cwd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user