Take care of a tilde on cookie file path

This handles cookie file path like "~/.gitcookies".

Change-Id: I87ba120a940fff38073d520f83b70654e6a239ba
This commit is contained in:
Daichi Ueura 2018-02-26 08:49:36 +09:00 committed by Daichi Ueura
parent 685320b000
commit ce7e02601c

View File

@ -534,7 +534,7 @@ def GetUrlCookieFile(url, quiet):
for line in p.stdout: for line in p.stdout:
line = line.strip() line = line.strip()
if line.startswith(cookieprefix): if line.startswith(cookieprefix):
cookiefile = line[len(cookieprefix):] cookiefile = os.path.expanduser(line[len(cookieprefix):])
if line.startswith(proxyprefix): if line.startswith(proxyprefix):
proxy = line[len(proxyprefix):] proxy = line[len(proxyprefix):]
# Leave subprocess open, as cookie file may be transient. # Leave subprocess open, as cookie file may be transient.
@ -553,7 +553,10 @@ def GetUrlCookieFile(url, quiet):
if e.errno == errno.ENOENT: if e.errno == errno.ENOENT:
pass # No persistent proxy. pass # No persistent proxy.
raise 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): def _preconnect(url):
m = URI_ALL.match(url) m = URI_ALL.match(url)