diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-19 15:24:05 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-19 15:24:05 -0400 |
commit | 90319afa41ca6d8a9ffe00d787dc3dcdff320f00 (patch) | |
tree | 68b9a324b9feb7ed45cc7ab24dc82e120cc26ff3 /Backend | |
parent | d36525e9745b90cc04abfeac6500ff646cb9c89b (diff) |
fsck --from
Fscking a remote is now supported. It's done by retrieving
the contents of the specified files from the remote, and checking them,
so can be an expensive operation.
(Several optimisations are possible, to speed it up, of course.. This is
the slow and stupid remote fsck to start with.)
Still, if the remote is a special remote, or a git repository that you
cannot run fsck in locally, it's nice to have the ability to fsck it.
If you have any directory special remotes, now would be a good time to
fsck them, in case you were hit by the data loss bug fixed in the
previous release!
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/SHA.hs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Backend/SHA.hs b/Backend/SHA.hs index 29f4e2e94..3adac65d8 100644 --- a/Backend/SHA.hs +++ b/Backend/SHA.hs @@ -9,7 +9,6 @@ module Backend.SHA (backends) where import Common.Annex import qualified Annex -import Annex.Content import Types.Backend import Types.Key import qualified Build.SysConfig as SysConfig @@ -97,18 +96,14 @@ keyValueE size file = keyValue size file >>= maybe (return Nothing) addE | otherwise = naiveextension {- A key's checksum is checked during fsck. -} -checkKeyChecksum :: SHASize -> Key -> Annex Bool -checkKeyChecksum size key = do +checkKeyChecksum :: SHASize -> Key -> FilePath -> Annex Bool +checkKeyChecksum size key file = do fast <- Annex.getState Annex.fast - file <- inRepo $ gitAnnexLocation key present <- liftIO $ doesFileExist file if not present || fast then return True - else check =<< shaN size file + else check <$> shaN size file where check s - | s == dropExtension (keyName key) = return True - | otherwise = do - dest <- moveBad key - warning $ "Bad file content; moved to " ++ dest - return False + | s == dropExtension (keyName key) = True + | otherwise = False |