From ce7e02601cfb0fdd0d9faa5cc2afa42717b63f1f Mon Sep 17 00:00:00 2001 From: Daichi Ueura Date: Mon, 26 Feb 2018 08:49:36 +0900 Subject: Take care of a tilde on cookie file path This handles cookie file path like "~/.gitcookies". Change-Id: I87ba120a940fff38073d520f83b70654e6a239ba --- git_config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'git_config.py') diff --git a/git_config.py b/git_config.py index 3ba9dbd1..854b2387 100644 --- a/git_config.py +++ b/git_config.py @@ -534,7 +534,7 @@ def GetUrlCookieFile(url, quiet): for line in p.stdout: line = line.strip() if line.startswith(cookieprefix): - cookiefile = line[len(cookieprefix):] + cookiefile = os.path.expanduser(line[len(cookieprefix):]) if line.startswith(proxyprefix): proxy = line[len(proxyprefix):] # Leave subprocess open, as cookie file may be transient. @@ -553,7 +553,10 @@ def GetUrlCookieFile(url, quiet): if e.errno == errno.ENOENT: pass # No persistent proxy. raise - yield GitConfig.ForUser().GetString('http.cookiefile'), None + cookiefile = GitConfig.ForUser().GetString('http.cookiefile') + if cookiefile: + cookiefile = os.path.expanduser(cookiefile) + yield cookiefile, None def _preconnect(url): m = URI_ALL.match(url) -- cgit v1.2.3-54-g00ecf