summaryrefslogtreecommitdiff
path: root/Command/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-13 12:40:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-13 12:40:10 -0400
commit3b27ac0a3072b6c9c5907d867439fdb096d4253f (patch)
tree050f2b57476e7bd606b4dce9a40a0683e5dd2bae /Command/Fsck.hs
parent7b2a2192cc6871a74177f35543a0590a022e51ca (diff)
windows: fix fsck --incremental to not crash
Although it is still not incremental.
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r--Command/Fsck.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index cdbb155c2..d58ce2826 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -463,7 +463,9 @@ getFsckTime key = do
-
- To guard against time stamp damange (for example, if an annex directory
- is copied without -a), the fsckstate file contains a time that should
- - be identical to its modification time. -}
+ - be identical to its modification time.
+ - (This is not possible to do on Windows.)
+ -}
recordStartTime :: Annex ()
recordStartTime = do
f <- fromRepo gitAnnexFsckState
@@ -471,8 +473,12 @@ recordStartTime = do
liftIO $ do
nukeFile f
withFile f WriteMode $ \h -> do
+#ifndef mingw32_HOST_OS
t <- modificationTime <$> getFileStatus f
hPutStr h $ showTime $ realToFrac t
+#else
+ noop
+#endif
where
showTime :: POSIXTime -> String
showTime = show
@@ -486,10 +492,14 @@ getStartTime = do
f <- fromRepo gitAnnexFsckState
liftIO $ catchDefaultIO Nothing $ do
timestamp <- modificationTime <$> getFileStatus f
+#ifndef mingw32_HOST_OS
t <- readishTime <$> readFile f
return $ if Just (realToFrac timestamp) == t
then Just timestamp
else Nothing
+#else
+ return $ Just timestamp
+#endif
where
readishTime :: String -> Maybe POSIXTime
readishTime s = utcTimeToPOSIXSeconds <$>