summaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <id@joeyh.name>2013-05-11 15:03:00 -0500
committerGravatar Joey Hess <id@joeyh.name>2013-05-11 15:03:00 -0500
commitd0fa82fb721cdc85438287e29a94cb796b7bc464 (patch)
tree26a2486b8e715b5937ce41679eafd42c02f2310a /Remote/Git.hs
parent679eaf6077375c5d59501d12c79e0891cbdd904f (diff)
git-annex now builds on Windows (doesn't work)
Diffstat (limited to 'Remote/Git.hs')
-rwxr-xr-x[-rw-r--r--]Remote/Git.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 752d70d23..0cc4da40c 100644..100755
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Remote.Git (
remote,
configRead,
@@ -341,6 +343,7 @@ copyFromRemote' r key file dest
copyFromRemoteCheap :: Remote -> Key -> FilePath -> Annex Bool
copyFromRemoteCheap r key file
+#ifndef __WINDOWS__
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) False $ do
loc <- liftIO $ gitAnnexLocation key (repo r) $
fromJust $ remoteGitConfig $ gitconfig r
@@ -350,6 +353,7 @@ copyFromRemoteCheap r key file
( copyFromRemote' r key Nothing file
, return False
)
+#endif
| otherwise = return False
{- Tries to copy a key's content to a remote's annex. -}
@@ -396,12 +400,14 @@ rsyncHelper callback params = do
- filesystem. Then cp could be faster. -}
rsyncOrCopyFile :: [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool
rsyncOrCopyFile rsyncparams src dest p =
+#ifdef __WINDOWS__
+ dorsync
+ where
+#else
ifM (sameDeviceIds src dest) (docopy, dorsync)
where
sameDeviceIds a b = (==) <$> (getDeviceId a) <*> (getDeviceId b)
getDeviceId f = deviceID <$> liftIO (getFileStatus $ parentDir f)
- dorsync = rsyncHelper (Just p) $
- rsyncparams ++ [Param src, Param dest]
docopy = liftIO $ bracket
(forkIO $ watchfilesize zeroBytesProcessed)
(void . tryIO . killThread)
@@ -417,6 +423,9 @@ rsyncOrCopyFile rsyncparams src dest p =
p sz
watchfilesize sz
_ -> watchfilesize oldsz
+#endif
+ dorsync = rsyncHelper (Just p) $
+ rsyncparams ++ [Param src, Param dest]
{- Generates rsync parameters that ssh to the remote and asks it
- to either receive or send the key's content. -}