diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-25 14:09:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-25 14:48:50 -0400 |
commit | f55d91cc91eec2debf4bb013ff2f5201ea1474ea (patch) | |
tree | 8b8701608fef4f49622018f26706ebd46bfae943 /Command | |
parent | c3aaa702c8fe4424dacfddfc255fca8d6149ad06 (diff) |
fix all remaining -Wall warnings on Windows
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 8 | ||||
-rw-r--r-- | Command/Fsck.hs | 22 |
2 files changed, 17 insertions, 13 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 662ce4242..ea4933748 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -218,15 +218,15 @@ link file key mcache = flip catchAnnex (undo file key) $ do l <- inRepo $ gitAnnexLink file key replaceFile file $ makeAnnexLink l -#ifdef WITH_CLIBS -#ifndef __ANDROID__ -- touch symlink to have same time as the original file, -- as provided in the InodeCache case mcache of +#if defined(WITH_CLIBS) && ! defined(__ANDROID__) Just c -> liftIO $ touch file (TimeSpec $ inodeCacheToMtime c) False - Nothing -> noop -#endif +#else + Just _ -> noop #endif + Nothing -> noop return l diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 6cf444967..a30e895d0 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -466,7 +466,8 @@ 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. - - (This is not possible to do on Windows.) + - (This is not possible to do on Windows, and so the timestamp in + - the file will only be equal or greater than the modification time.) -} recordStartTime :: Annex () recordStartTime = do @@ -477,10 +478,10 @@ recordStartTime = do withFile f WriteMode $ \h -> do #ifndef mingw32_HOST_OS t <- modificationTime <$> getFileStatus f - hPutStr h $ showTime $ realToFrac t #else - noop + t <- getPOSIXTime #endif + hPutStr h $ showTime $ realToFrac t where showTime :: POSIXTime -> String showTime = show @@ -494,15 +495,18 @@ 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 + let fromstatus = Just (realToFrac timestamp) + fromfile <- readishTime <$> readFile f + return $ if matchingtimestamp fromfile fromstatus then Just timestamp else Nothing -#else - return $ Just timestamp -#endif where readishTime :: String -> Maybe POSIXTime readishTime s = utcTimeToPOSIXSeconds <$> parseTime defaultTimeLocale "%s%Qs" s + matchingtimestamp fromfile fromstatus = +#ifndef mingw32_HOST_OS + fromfile == fromstatus +#else + fromfile >= fromstatus +#endif |