From 19ee56559a191e0e794380363a1bd0b0c57ea22a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 13 Nov 2010 16:15:45 -0400 Subject: better fsck file handling --- Command.hs | 4 ++++ Command/Fsck.hs | 16 +++++----------- doc/walkthrough.mdwn | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Command.hs b/Command.hs index 3f68cf661..40a21cacc 100644 --- a/Command.hs +++ b/Command.hs @@ -44,6 +44,7 @@ type SubCmdStartString = String -> SubCmdStart type SubCmdSeekBackendFiles = SubCmdStartBackendFile -> SubCmdSeek type SubCmdStartBackendFile = (FilePath, Maybe Backend) -> SubCmdStart type SubCmdSeekNothing = SubCmdStart -> SubCmdSeek +type SubCmdStartNothing = SubCmdStart data SubCommand = SubCommand { subcmdname :: String, @@ -143,6 +144,9 @@ withKeys :: SubCmdSeekStrings withKeys a params = return $ map a params withTempFile :: SubCmdSeekStrings 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 - none are specified. -} diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 85a26a89b..5b731a696 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -16,20 +16,14 @@ import Messages import qualified Command.FsckFile 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 - 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 +start :: SubCmdStartNothing +start = do + showStart "fsck" "" + return $ Just perform perform :: SubCmdPerform perform = do diff --git a/doc/walkthrough.mdwn b/doc/walkthrough.mdwn index cdb2392e7..9a6ee220c 100644 --- a/doc/walkthrough.mdwn +++ b/doc/walkthrough.mdwn @@ -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. # git annex fsck my_cool_big_file - fsck (only checking specified files) ok fsck my_cool_big_file (checksum...) ok ## fsck: When things go wrong -- cgit v1.2.3