fsck: avoid global checks if files specified

This commit is contained in:
Joey Hess 2010-11-13 16:03:25 -04:00
parent d9d79a7980
commit 498c8e8544
4 changed files with 17 additions and 12 deletions

View file

@ -126,8 +126,8 @@ backendPairs :: SubCmdSeekBackendFiles
backendPairs a files = do
pairs <- Backend.chooseBackends files
return $ map a pairs
withDescription :: SubCmdSeekStrings
withDescription a params = return [a $ unwords params]
withString :: SubCmdSeekStrings
withString a params = return [a $ unwords params]
withFilesToBeCommitted :: SubCmdSeekStrings
withFilesToBeCommitted a params = do
repo <- Annex.gitRepo
@ -143,8 +143,6 @@ withKeys :: SubCmdSeekStrings
withKeys a params = return $ map a params
withTempFile :: SubCmdSeekStrings
withTempFile a params = return $ map a params
withNothing :: SubCmdSeekNothing
withNothing a _ = return [a]
{- Default to acting on all files matching the seek action if
- none are specified. -}

View file

@ -16,13 +16,20 @@ import Messages
import qualified Command.FsckFile
seek :: [SubCmdSeek]
seek = [withNothing start, withAll withFilesInGit Command.FsckFile.start]
seek = [withString start, withAll withFilesInGit Command.FsckFile.start]
{- Checks the whole annex for problems. -}
start :: SubCmdStart
start = do
showStart "fsck" ""
return $ Just perform
{- Checks the whole annex for problems, only if specific files were not
- specified. -}
start :: SubCmdStartString
start whatspecified = do
if (null whatspecified)
then do
showStart "fsck" ""
return $ Just perform
else do
showStart "fsck" ""
showNote "only checking specified files"
return $ Just $ return $ Just $ return True
perform :: SubCmdPerform
perform = do

View file

@ -19,7 +19,7 @@ import Version
import Messages
seek :: [SubCmdSeek]
seek = [withDescription start]
seek = [withString start]
{- Stores description for the repository etc. -}
start :: SubCmdStartString

View file

@ -295,7 +295,7 @@ You can also specifiy the files to check. This is particularly useful if
you're using sha1 and don't want to spend a long time checksumming everything.
# git annex fsck my_cool_big_file
fsck (checking for unused data...) ok
fsck (only checking specified files) ok
fsck my_cool_big_file (checksum...) ok
## fsck: When things go wrong