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]>
---
On Mon, Aug 5, 2013 at 10:30 PM, Felipe Contreras <[email protected]>
wrote:
> Shouldn't that be the job of the shell? (s/~/$HOME/)
I'm not sure what you mean here. Does it mean that I should stop cloning using
"~" ?
I also send this patch as I think it makes more sense to keep the ~ in the
path, but just make
sure we don't build invalid absolute path.
By the way, I don't exactly understand why:
abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
is done right after instead of:
abs_url = os.path.abspath(orig_url)
Cheers,
Antoine
contrib/remote-helpers/git-remote-hg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/remote-helpers/git-remote-hg
b/contrib/remote-helpers/git-remote-hg
index 1897327..861c498 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -1135,7 +1135,7 @@ def do_option(parser):
def fix_path(alias, repo, orig_url):
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
abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html