windows: fix fsck --incremental to not crash

Although it is still not incremental.
This commit is contained in:
Joey Hess 2014-02-13 12:40:10 -04:00
parent 1c6dc0521f
commit 8952ccec1b
2 changed files with 14 additions and 4 deletions

View file

@ -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 <$>

View file

@ -38,9 +38,6 @@ now! --[[Joey]]
starting git-annex from the menu failed with `file://C:\Documents does
not exist`. The local repo was `C:\Documents and Settings\...\...`
* View debug log is empty in windows -- all log must goes to console.
* Adding removable drive repo failed setting core.fsyncobjectfiles
Error: `could not lock config file /annex/.git/config: No such file or
directory` -- seems to be a drive path problem?
* Local pairing seems to fail, after acking on Linux box, it stalls.
* rsync.net setup failed. Seems to have generated a hostname including
the directory somehow.
@ -51,6 +48,9 @@ now! --[[Joey]]
* glacier-cli is not easily available (probably)
* When clicking on the Files at the top of the webapp, a file
browser *is* opened, but it has a Z-order underneath the web browser.
* Incremental fsck sets the sticky bit to record when a file is fscked,
and this is not done on windows, so fsck doesn't behave incrementally
there.
## stuff needing testing