Commit 5a5537dc authored by Edward Lesmes's avatar Edward Lesmes Committed by LUCI CQ

git-cl: Fix retrieving gitcookies path.

Decode the result of reading http.cookiefile from git config

Bug: 1066992
Change-Id: I1d4f2c8e54f717ef61ab4e630f3f66206c56047e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2132774Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 4741a127
......@@ -203,8 +203,9 @@ class CookiesAuthenticator(Authenticator):
if os.getenv('GIT_COOKIES_PATH'):
return os.getenv('GIT_COOKIES_PATH')
try:
return subprocess2.check_output(
['git', 'config', '--path', 'http.cookiefile']).strip()
path = subprocess2.check_output(
['git', 'config', '--path', 'http.cookiefile'])
return path.decode('utf-8', 'ignore').strip()
except subprocess2.CalledProcessError:
return os.path.expanduser(os.path.join('~', '.gitcookies'))
......
......@@ -126,7 +126,7 @@ class CookiesAuthenticatorTest(unittest.TestCase):
os.path.expanduser(os.path.join('~', '.gitcookies')),
gerrit_util.CookiesAuthenticator().get_gitcookies_path())
subprocess2.check_output.side_effect = ['http.cookiefile']
subprocess2.check_output.side_effect = [b'http.cookiefile']
self.assertEqual(
'http.cookiefile',
gerrit_util.CookiesAuthenticator().get_gitcookies_path())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment