Skip to content

Commit 33f66b2

Browse files
apelissegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b48493e commit 33f66b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/remote-helpers/git-remote-hg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ def do_option(parser):
11241124

11251125
def fix_path(alias, repo, orig_url):
11261126
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)):
11281128
return
11291129
abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
11301130
cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]

0 commit comments

Comments
 (0)