summaryrefslogtreecommitdiff
path: root/Git/Construct.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-14 15:27:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-14 15:27:39 -0400
commit724d5185d48aee309af1a6d13927c4f7108610fd (patch)
treeb5d38fa6613356fcaf26d135eb5d9734310dadfe /Git/Construct.hs
parentccb74be7a8d74e7c17571fd5cf6d66c1b8bda343 (diff)
detect local urls on DOS
Diffstat (limited to 'Git/Construct.hs')
-rw-r--r--Git/Construct.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Git/Construct.hs b/Git/Construct.hs
index 633e50b6b..23022eb95 100644
--- a/Git/Construct.hs
+++ b/Git/Construct.hs
@@ -21,6 +21,8 @@ module Git.Construct (
checkForRepo,
) where
+{-# LANGUAGE CPP #-}
+
import System.Posix.User
import qualified Data.Map as M hiding (map, split)
import Network.URI
@@ -139,6 +141,9 @@ fromRemoteLocation :: String -> Repo -> IO Repo
fromRemoteLocation s repo = gen $ calcloc s
where
gen v
+#ifdef __WINDOWS__
+ | dosstyle v = fromRemotePath v repo
+#endif
| scpstyle v = fromUrl $ scptourl v
| urlstyle v = fromUrl v
| otherwise = fromRemotePath v repo
@@ -172,6 +177,11 @@ fromRemoteLocation s repo = gen $ calcloc s
| "/" `isPrefixOf` d = d
| "~" `isPrefixOf` d = '/':d
| otherwise = "/~/" ++ d
+#ifdef __WINDOWS__
+ -- git on Windows will write a path to .git/config with "drive:",
+ -- which is not to be confused with a "host:"
+ dosstyle = hasDrive
+#endif
{- Constructs a Repo from the path specified in the git remotes of
- another Repo. -}