fix inverted logic
This commit is contained in:
parent
17c5a8dae5
commit
08854afa10
2 changed files with 16 additions and 13 deletions
|
@ -10,11 +10,11 @@ module Annex.Content.Direct (
|
||||||
removeAssociatedFile,
|
removeAssociatedFile,
|
||||||
addAssociatedFile,
|
addAssociatedFile,
|
||||||
goodContent,
|
goodContent,
|
||||||
changedFileStatus,
|
|
||||||
recordedInodeCache,
|
recordedInodeCache,
|
||||||
updateInodeCache,
|
updateInodeCache,
|
||||||
writeInodeCache,
|
writeInodeCache,
|
||||||
sameInodeCache,
|
sameInodeCache,
|
||||||
|
sameFileStatus,
|
||||||
removeInodeCache,
|
removeInodeCache,
|
||||||
toInodeCache,
|
toInodeCache,
|
||||||
inodesChanged,
|
inodesChanged,
|
||||||
|
@ -99,15 +99,6 @@ normaliseAssociatedFile file = do
|
||||||
goodContent :: Key -> FilePath -> Annex Bool
|
goodContent :: Key -> FilePath -> Annex Bool
|
||||||
goodContent key file = sameInodeCache file =<< recordedInodeCache key
|
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. -}
|
{- Gets the recorded inode cache for a key. -}
|
||||||
recordedInodeCache :: Key -> Annex (Maybe InodeCache)
|
recordedInodeCache :: Key -> Annex (Maybe InodeCache)
|
||||||
recordedInodeCache key = withInodeCacheFile key $ \f ->
|
recordedInodeCache key = withInodeCacheFile key $ \f ->
|
||||||
|
@ -141,6 +132,18 @@ sameInodeCache file (Just old) = go =<< liftIO (genInodeCache file)
|
||||||
go Nothing = return False
|
go Nothing = return False
|
||||||
go (Just curr) = compareInodeCaches curr old
|
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. -}
|
{- If the inodes have changed, only the size and mtime are compared. -}
|
||||||
compareInodeCaches :: InodeCache -> InodeCache -> Annex Bool
|
compareInodeCaches :: InodeCache -> InodeCache -> Annex Bool
|
||||||
compareInodeCaches x y
|
compareInodeCaches x y
|
||||||
|
|
|
@ -181,11 +181,11 @@ onAddDirect file fs = do
|
||||||
v <- liftAnnex $ catKeyFile file
|
v <- liftAnnex $ catKeyFile file
|
||||||
case (v, fs) of
|
case (v, fs) of
|
||||||
(Just key, Just filestatus) ->
|
(Just key, Just filestatus) ->
|
||||||
ifM (liftAnnex $ changedFileStatus key filestatus)
|
ifM (liftAnnex $ sameFileStatus key filestatus)
|
||||||
( do
|
( noChange
|
||||||
|
, do
|
||||||
liftAnnex $ changedDirect key file
|
liftAnnex $ changedDirect key file
|
||||||
pendingAddChange file
|
pendingAddChange file
|
||||||
, noChange
|
|
||||||
)
|
)
|
||||||
_ -> pendingAddChange file
|
_ -> pendingAddChange file
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue