diff options
author | Joey Hess <joey@kitenet.net> | 2010-11-28 15:28:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-11-28 15:28:20 -0400 |
commit | 653ad35a9f728ed5b3e9b557cdfb15a19b4afe16 (patch) | |
tree | 40e8ed2880ea291f33ef20e931b9d9d1d8c7189c /Command/Fsck.hs | |
parent | 92e5d28ca83d057a3d8f5d7d30806642de699172 (diff) |
In .gitattributes, the git-annex-numcopies attribute can be used to control the number of copies to retain of different types of files.
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r-- | Command/Fsck.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index dc0168801..4341f85cd 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -11,19 +11,22 @@ import Command import qualified Backend import Types import Messages +import Utility seek :: [SubCmdSeek] -seek = [withAll withFilesInGit start] +seek = [withAll (withAttrFilesInGit "git-annex-numcopies") start] {- Checks a file's backend data for problems. -} -start :: SubCmdStartString -start file = isAnnexed file $ \(key, backend) -> do +start :: SubCmdStartAttrFile +start (file, attr) = isAnnexed file $ \(key, backend) -> do showStart "fsck" file - return $ Just $ perform key backend + return $ Just $ perform key backend numcopies + where + numcopies = readMaybe attr :: Maybe Int -perform :: Key -> Backend -> SubCmdPerform -perform key backend = do - success <- Backend.fsckKey backend key +perform :: Key -> Backend -> Maybe Int -> SubCmdPerform +perform key backend numcopies = do + success <- Backend.fsckKey backend key numcopies if success then return $ Just $ return True else return Nothing |