better fsck file handling

This commit is contained in:
Joey Hess 2010-11-13 16:15:45 -04:00
parent 7293ba2940
commit 19ee56559a
3 changed files with 9 additions and 12 deletions

View file

@ -44,6 +44,7 @@ type SubCmdStartString = String -> SubCmdStart
type SubCmdSeekBackendFiles = SubCmdStartBackendFile -> SubCmdSeek type SubCmdSeekBackendFiles = SubCmdStartBackendFile -> SubCmdSeek
type SubCmdStartBackendFile = (FilePath, Maybe Backend) -> SubCmdStart type SubCmdStartBackendFile = (FilePath, Maybe Backend) -> SubCmdStart
type SubCmdSeekNothing = SubCmdStart -> SubCmdSeek type SubCmdSeekNothing = SubCmdStart -> SubCmdSeek
type SubCmdStartNothing = SubCmdStart
data SubCommand = SubCommand { data SubCommand = SubCommand {
subcmdname :: String, subcmdname :: String,
@ -143,6 +144,9 @@ withKeys :: SubCmdSeekStrings
withKeys a params = return $ map a params withKeys a params = return $ map a params
withTempFile :: SubCmdSeekStrings withTempFile :: SubCmdSeekStrings
withTempFile a params = return $ map a params withTempFile a params = return $ map a params
withNothing :: SubCmdSeekNothing
withNothing a [] = return [a]
withNothing _ _ = return []
{- Default to acting on all files matching the seek action if {- Default to acting on all files matching the seek action if
- none are specified. -} - none are specified. -}

View file

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

View file

@ -295,7 +295,6 @@ 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. you're using sha1 and don't want to spend a long time checksumming everything.
# git annex fsck my_cool_big_file # git annex fsck my_cool_big_file
fsck (only checking specified files) ok
fsck my_cool_big_file (checksum...) ok fsck my_cool_big_file (checksum...) ok
## fsck: When things go wrong ## fsck: When things go wrong