diff options
author | Joey Hess <joey@kitenet.net> | 2013-02-22 17:01:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-02-22 17:01:48 -0400 |
commit | cc1e06c9a5e2ce18c5a001052ffa3af09d212155 (patch) | |
tree | cf07d55f0224596029121a331e8f82756848b98c /Annex | |
parent | e54b44fad998add6e413a7109d6b8416cce3a209 (diff) |
fix inverted logic
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content/Direct.hs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs index 3bb38764b..ef4704633 100644 --- a/Annex/Content/Direct.hs +++ b/Annex/Content/Direct.hs @@ -10,11 +10,11 @@ module Annex.Content.Direct ( removeAssociatedFile, addAssociatedFile, goodContent, - changedFileStatus, recordedInodeCache, updateInodeCache, writeInodeCache, sameInodeCache, + sameFileStatus, removeInodeCache, toInodeCache, inodesChanged, @@ -99,15 +99,6 @@ normaliseAssociatedFile file = do goodContent :: Key -> FilePath -> Annex Bool goodContent key file = sameInodeCache file =<< recordedInodeCache key -changedFileStatus :: Key -> FileStatus -> Annex Bool -changedFileStatus key status = do - old <- recordedInodeCache key - let curr = toInodeCache status - case (old, curr) of - (Just o, Just c) -> compareInodeCaches o c - (Nothing, Nothing) -> return True - _ -> return False - {- Gets the recorded inode cache for a key. -} recordedInodeCache :: Key -> Annex (Maybe InodeCache) recordedInodeCache key = withInodeCacheFile key $ \f -> @@ -141,6 +132,18 @@ sameInodeCache file (Just old) = go =<< liftIO (genInodeCache file) go Nothing = return False go (Just curr) = compareInodeCaches curr old +{- Checks if a FileStatus matches the recorded InodeCache of a file. -} +sameFileStatus :: Key -> FileStatus -> Annex Bool +sameFileStatus key status = do + old <- recordedInodeCache key + let curr = toInodeCache status + r <- case (old, curr) of + (Just o, Just c) -> compareInodeCaches o c + (Nothing, Nothing) -> return True + _ -> return False + liftIO $ print ("sameFileStatus", old, curr, r) + return r + {- If the inodes have changed, only the size and mtime are compared. -} compareInodeCaches :: InodeCache -> InodeCache -> Annex Bool compareInodeCaches x y |