summaryrefslogtreecommitdiff
path: root/Git/Remote.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Git/Remote.hs')
-rw-r--r--Git/Remote.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Git/Remote.hs b/Git/Remote.hs
index 9d969c4..7e8e5f8 100644
--- a/Git/Remote.hs
+++ b/Git/Remote.hs
@@ -70,7 +70,7 @@ remoteLocationIsSshUrl _ = False
parseRemoteLocation :: String -> Repo -> RemoteLocation
parseRemoteLocation s repo = ret $ calcloc s
where
- ret v
+ ret v
#ifdef mingw32_HOST_OS
| dosstyle v = RemotePath (dospath v)
#endif
@@ -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