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/+/2132774
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
changes/74/2132774/2
Edward Lesmes 6 years ago committed by LUCI CQ
parent 4741a12797
commit 5a5537dc63

@ -203,8 +203,9 @@ class CookiesAuthenticator(Authenticator):
if os.getenv('GIT_COOKIES_PATH'): if os.getenv('GIT_COOKIES_PATH'):
return os.getenv('GIT_COOKIES_PATH') return os.getenv('GIT_COOKIES_PATH')
try: try:
return subprocess2.check_output( path = subprocess2.check_output(
['git', 'config', '--path', 'http.cookiefile']).strip() ['git', 'config', '--path', 'http.cookiefile'])
return path.decode('utf-8', 'ignore').strip()
except subprocess2.CalledProcessError: except subprocess2.CalledProcessError:
return os.path.expanduser(os.path.join('~', '.gitcookies')) return os.path.expanduser(os.path.join('~', '.gitcookies'))

@ -126,7 +126,7 @@ class CookiesAuthenticatorTest(unittest.TestCase):
os.path.expanduser(os.path.join('~', '.gitcookies')), os.path.expanduser(os.path.join('~', '.gitcookies')),
gerrit_util.CookiesAuthenticator().get_gitcookies_path()) gerrit_util.CookiesAuthenticator().get_gitcookies_path())
subprocess2.check_output.side_effect = ['http.cookiefile'] subprocess2.check_output.side_effect = [b'http.cookiefile']
self.assertEqual( self.assertEqual(
'http.cookiefile', 'http.cookiefile',
gerrit_util.CookiesAuthenticator().get_gitcookies_path()) gerrit_util.CookiesAuthenticator().get_gitcookies_path())

Loading…
Cancel
Save