From 0d470211d6aa10e89eed2071004e61f08d128f4a Mon Sep 17 00:00:00 2001 From: Allen Li Date: Tue, 25 Jun 2024 21:05:52 +0000 Subject: [PATCH] [git_cl] Move new auth handling up in creds-check The CookiesAuthenticator is mutually exclusive with new auth. Bug: b/348024314 Change-Id: I70f2e1976b54572c330fcc8acff30e8448e540ca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5651990 Reviewed-by: Yiwei Zhang Commit-Queue: Allen Li --- git_cl.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/git_cl.py b/git_cl.py index 79f6903e6..d7b822804 100755 --- a/git_cl.py +++ b/git_cl.py @@ -3851,6 +3851,10 @@ def CMDcreds_check(parser, args): """Checks credentials and suggests changes.""" _, _ = parser.parse_args(args) + if newauth.Enabled(): + ConfigureGitRepoAuth() + return 0 + # Code below checks .gitcookies. Abort if using something else. authn = gerrit_util.Authenticator.get() if not isinstance(authn, gerrit_util.CookiesAuthenticator): @@ -3866,19 +3870,16 @@ def CMDcreds_check(parser, args): 'export SKIP_GCE_AUTH_FOR_GIT=1 in your env.') DieWithError(message) - if newauth.Enabled(): - ConfigureGitRepoAuth() - else: - checker = _GitCookiesChecker() - checker.ensure_configured_gitcookies() + checker = _GitCookiesChecker() + checker.ensure_configured_gitcookies() - print('Your .gitcookies have credentials for these hosts:') - checker.print_current_creds() + print('Your .gitcookies have credentials for these hosts:') + checker.print_current_creds() - if not checker.find_and_report_problems(): - print('\nNo problems detected in your .gitcookies file.') - return 0 - return 1 + if not checker.find_and_report_problems(): + print('\nNo problems detected in your .gitcookies file.') + return 0 + return 1 @metrics.collector.collect_metrics('git cl baseurl')