aboutsummaryrefslogtreecommitdiff
path: root/Git/Remote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-10 14:17:02 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-10 14:17:02 -0400
commit5f380c3848c680769986e9b953ee53cbe021ec0c (patch)
tree1101988da144a89f39a1546c72d4103d9f4e83e3 /Git/Remote.hs
parent9b6bdf5b94fd49c37cc79290912cf81c6fac0b13 (diff)
Fix parsing of ipv6 address in git remote address when it was not formatted as an url.
Diffstat (limited to 'Git/Remote.hs')
-rw-r--r--Git/Remote.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Git/Remote.hs b/Git/Remote.hs
index 9d969c416..7573c87ee 100644
--- a/Git/Remote.hs
+++ b/Git/Remote.hs
@@ -102,7 +102,13 @@ parseRemoteLocation s repo = ret $ calcloc s
&& not ("::" `isInfixOf` v)
scptourl v = "ssh://" ++ host ++ slash dir
where
- (host, dir) = separate (== ':') v
+ (host, dir)
+ -- handle ipv6 address inside []
+ | "[" `isPrefixOf` v = case break (== ']') v of
+ (h, ']':':':d) -> (h ++ "]", d)
+ (h, ']':d) -> (h ++ "]", d)
+ (h, d) -> (h, d)
+ | otherwise = separate (== ':') v
slash d | d == "" = "/~/" ++ d
| "/" `isPrefixOf` d = d
| "~" `isPrefixOf` d = '/':d