mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-11-11 05:35:40 +01:00
remote-hg: fix path when cloning with tilde expansion
The current code fixes the path to make it absolute when cloning, but
doesn't consider tilde expansion, so that scenario fails throwing an
exception because /home/myuser/~/my/repository doesn't exists:
$ git clone hg::~/my/repository && cd repository && git fetch
Expand the tilde when checking if the path is absolute, so that we don't
fix a path that doesn't need to be.
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Felipe Contreras
parent
6d75ce8234
commit
b7f9554a8f
@@ -1124,7 +1124,7 @@ def do_option(parser):
|
|||||||
|
|
||||||
def fix_path(alias, repo, orig_url):
|
def fix_path(alias, repo, orig_url):
|
||||||
url = urlparse.urlparse(orig_url, 'file')
|
url = urlparse.urlparse(orig_url, 'file')
|
||||||
if url.scheme != 'file' or os.path.isabs(url.path):
|
if url.scheme != 'file' or os.path.isabs(os.path.expanduser(url.path)):
|
||||||
return
|
return
|
||||||
abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
|
abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
|
||||||
cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]
|
cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]
|
||||||
|
|||||||
Reference in New Issue
Block a user