gerrit_util: Expand user path from http.cookiefile config

This fixes an issue where "~" in user http.cookiefile config doesn't get
expanded and causes failures when "git cl" commands tries to read the
credentials.

Expand the path returned by scm.GIT.GetConfig() but not just the default
value.

Bug: b/341619336
Change-Id: Ib89d5b86710a0a6bb6ca669639eeec6adc75689d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5547345
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Fei Shao <fshao@chromium.org>
changes/45/5547345/2
Fei Shao 11 months ago committed by LUCI CQ
parent 7d046b15fc
commit b4fbce4794

@ -218,9 +218,9 @@ class CookiesAuthenticator(Authenticator):
if os.getenv('GIT_COOKIES_PATH'):
return os.getenv('GIT_COOKIES_PATH')
return scm.GIT.GetConfig(
os.getcwd(), 'http.cookiefile',
os.path.expanduser(os.path.join('~', '.gitcookies')))
return os.path.expanduser(
scm.GIT.GetConfig(os.getcwd(), 'http.cookiefile',
os.path.join('~', '.gitcookies')))
@classmethod
def _get_gitcookies(cls):

Loading…
Cancel
Save