All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remote-hg: fix path when cloning with tilde expansion
@ 2013-08-05 20:12 Antoine Pelisse
  2013-08-05 20:30 ` Felipe Contreras
  0 siblings, 1 reply; 20+ messages in thread
From: Antoine Pelisse @ 2013-08-05 20:12 UTC (permalink / raw)
  To: git; +Cc: Antoine Pelisse

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

Fix that by using python os.path.expanduser method.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
 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 02404dc..4bbd296 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -1137,7 +1137,7 @@ def fix_path(alias, repo, orig_url):
     url = urlparse.urlparse(orig_url, 'file')
     if url.scheme != 'file' or os.path.isabs(url.path):
         return
-    abs_url = urlparse.urljoin("%s/" % os.getcwd(), orig_url)
+    abs_url = os.path.abspath(os.path.expanduser(orig_url))
     cmd = ['git', 'config', 'remote.%s.url' % alias, "hg::%s" % abs_url]
     subprocess.call(cmd)
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-08-10 15:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 20:12 [PATCH] remote-hg: fix path when cloning with tilde expansion Antoine Pelisse
2013-08-05 20:30 ` Felipe Contreras
2013-08-05 20:32   ` Antoine Pelisse
2013-08-09 17:13   ` Antoine Pelisse
2013-08-09 18:49     ` Junio C Hamano
2013-08-09 20:09       ` Antoine Pelisse
2013-08-09 20:53         ` Junio C Hamano
2013-08-09 21:19           ` Antoine Pelisse
2013-08-09 21:45             ` Junio C Hamano
2013-08-09 21:55               ` Antoine Pelisse
2013-08-09 21:55             ` Felipe Contreras
2013-08-09 22:15               ` Junio C Hamano
2013-08-09 22:28                 ` Felipe Contreras
2013-08-09 23:39                   ` Junio C Hamano
2013-08-09 23:43                     ` Felipe Contreras
2013-08-10  5:18                       ` Junio C Hamano
2013-08-10  6:39                         ` Felipe Contreras
2013-08-10  6:50                           ` Junio C Hamano
2013-08-10  7:07                             ` Felipe Contreras
2013-08-10 15:15                               ` Antoine Pelisse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.