summaryrefslogtreecommitdiff
path: root/Git/Remote.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-10-12 14:32:56 -0400
committerJoey Hess <joey@kitenet.net>2014-10-12 14:32:56 -0400
commitefef527d5b2e42e261fa7af6947aad6553426ebe (patch)
tree082a5dad993557e9dffd76a69d4087371da8ed42 /Git/Remote.hs
parentab1cf3570207bd08ae0abbba183a8c570c0361f5 (diff)
downloadgit-repair-efef527d5b2e42e261fa7af6947aad6553426ebe.tar.gz
Merge from git-annex.
Includes changing to new exceptions library, and some whitespace fixes.
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