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>
Antoine Pelisse committed
Aug 9, 2013 at 19:13 UTC
33f66b25e1880db9d5b2f665b42d5e867d118b38
1 file changed
+1
-1
contrib/remote-helpers/git-remote-hg
+1
-1
@@ -1124,7 +1124,7 @@ def do_option(parser):
1124
1125
def fix_path(alias, repo, orig_url):
1126
url = urlparse.urlparse(orig_url, 'file')
1127
- if url.scheme != 'file' or os.path.isabs(url.path):
1127
+ if url.scheme != 'file' or os.path.isabs(os.path.expanduser(url.path)):
1128
return
1129
abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
1130
cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]