summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-08 12:41:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-08 12:41:09 -0400
commit8e26e0d90567d2b002c80a99e12b1b8f756069ad (patch)
treecce85f773b898c4e9365e8bed2df3aa85554f5ad /Command
parentd684a57fd0c36d8dbbdebd2cef34f3a89f547069 (diff)
blog for yesterday
Diffstat (limited to 'Command')
-rw-r--r--Command/Fsck.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 7ea4294a5..870dac07d 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -16,6 +16,7 @@ import qualified Types.Backend
import qualified Types.Key
import qualified Backend
import Annex.Content
+import Annex.Content.Direct
import Annex.Perms
import Logs.Location
import Logs.Trust
@@ -301,14 +302,20 @@ checkKeySizeOr bad key file = case Types.Key.keySize key of
{- Runs the backend specific check on a key's content.
-
- - In direct mode, this is skipped, because files can change at any time. -}
+ - In direct mode this is not done if the file has clearly been modified,
+ - because modification of direct mode files is allowed. It's still done
+ - if the file does not appear modified, to catch disk corruption, etc.
+ -}
checkBackend :: Backend -> Key -> Annex Bool
-checkBackend backend key = ifM isDirect
- ( return True
- , do
- file <- inRepo $ gitAnnexLocation key
- checkBackendOr badContent backend key file
- )
+checkBackend backend key = do
+ file <- inRepo $ gitAnnexLocation key
+ ifM isDirect
+ ( ifM (goodContent key file)
+ ( checkBackendOr badContent backend key file
+ , return True
+ )
+ , checkBackendOr badContent backend key file
+ )
checkBackendRemote :: Backend -> Key -> Remote -> Maybe FilePath -> Annex Bool
checkBackendRemote backend key remote = maybe (return True) go