diff --git a/git_cl.py b/git_cl.py index 66616a1c1..64aa3adb0 100755 --- a/git_cl.py +++ b/git_cl.py @@ -3742,10 +3742,11 @@ class _GitCookiesChecker(object): def print_current_creds(self): hosts = sorted(self.get_hosts_with_creds()) if not hosts: - print('No Git/Gerrit credentials found') + print('No Git/Gerrit credentials found.') return lengths = [max(map(len, (row[i] for row in hosts))) for i in range(3)] header = [('Host', 'User', 'Which file'), ['=' * l for l in lengths]] + print('Your .gitcookies have credentials for these hosts:') for row in (header + hosts): print('\t'.join((('%%+%ds' % l) % s) for l, s in zip(lengths, row))) @@ -3905,7 +3906,6 @@ def CMDcreds_check(parser, args): checker = _GitCookiesChecker() checker.ensure_configured_gitcookies() - print('Your .gitcookies have credentials for these hosts:') checker.print_current_creds() if not checker.find_and_report_problems(): diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 676c9f672..210ca72dd 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -3135,6 +3135,7 @@ class TestGitCl(unittest.TestCase): CookiesAuthenticatorMock).start() git_cl._GitCookiesChecker().print_current_creds() self.assertEqual(list(sys.stdout.getvalue().splitlines()), [ + 'Your .gitcookies have credentials for these hosts:', ' Host\tUser\t Which file', '============================\t====\t===========', 'host-review.googlesource.com\tuser\t.gitcookies', @@ -3144,6 +3145,7 @@ class TestGitCl(unittest.TestCase): sys.stdout.truncate(0) git_cl._GitCookiesChecker().print_current_creds() self.assertEqual(list(sys.stdout.getvalue().splitlines()), [ + 'Your .gitcookies have credentials for these hosts:', ' Host\tUser\t Which file', '============================\t====\t===========', 'host-review.googlesource.com\tuser\t.gitcookies',