summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Content/Direct.hs23
-rw-r--r--Assistant/Threads/Watcher.hs6
2 files changed, 16 insertions, 13 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
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs
index 8c77fa64a..be82a105f 100644
--- a/Assistant/Threads/Watcher.hs
+++ b/Assistant/Threads/Watcher.hs
@@ -181,11 +181,11 @@ onAddDirect file fs = do
v <- liftAnnex $ catKeyFile file
case (v, fs) of
(Just key, Just filestatus) ->
- ifM (liftAnnex $ changedFileStatus key filestatus)
- ( do
+ ifM (liftAnnex $ sameFileStatus key filestatus)
+ ( noChange
+ , do
liftAnnex $ changedDirect key file
pendingAddChange file
- , noChange
)
_ -> pendingAddChange file