fsck: avoid global checks if files specified
This commit is contained in:
parent
d9d79a7980
commit
498c8e8544
4 changed files with 17 additions and 12 deletions
|
@ -126,8 +126,8 @@ backendPairs :: SubCmdSeekBackendFiles
|
||||||
backendPairs a files = do
|
backendPairs a files = do
|
||||||
pairs <- Backend.chooseBackends files
|
pairs <- Backend.chooseBackends files
|
||||||
return $ map a pairs
|
return $ map a pairs
|
||||||
withDescription :: SubCmdSeekStrings
|
withString :: SubCmdSeekStrings
|
||||||
withDescription a params = return [a $ unwords params]
|
withString a params = return [a $ unwords params]
|
||||||
withFilesToBeCommitted :: SubCmdSeekStrings
|
withFilesToBeCommitted :: SubCmdSeekStrings
|
||||||
withFilesToBeCommitted a params = do
|
withFilesToBeCommitted a params = do
|
||||||
repo <- Annex.gitRepo
|
repo <- Annex.gitRepo
|
||||||
|
@ -143,8 +143,6 @@ 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]
|
|
||||||
|
|
||||||
{- 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. -}
|
||||||
|
|
|
@ -16,13 +16,20 @@ import Messages
|
||||||
import qualified Command.FsckFile
|
import qualified Command.FsckFile
|
||||||
|
|
||||||
seek :: [SubCmdSeek]
|
seek :: [SubCmdSeek]
|
||||||
seek = [withNothing start, withAll withFilesInGit Command.FsckFile.start]
|
seek = [withString start, withAll withFilesInGit Command.FsckFile.start]
|
||||||
|
|
||||||
{- Checks the whole annex for problems. -}
|
{- Checks the whole annex for problems, only if specific files were not
|
||||||
start :: SubCmdStart
|
- specified. -}
|
||||||
start = do
|
start :: SubCmdStartString
|
||||||
|
start whatspecified = 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
|
||||||
|
|
|
@ -19,7 +19,7 @@ import Version
|
||||||
import Messages
|
import Messages
|
||||||
|
|
||||||
seek :: [SubCmdSeek]
|
seek :: [SubCmdSeek]
|
||||||
seek = [withDescription start]
|
seek = [withString start]
|
||||||
|
|
||||||
{- Stores description for the repository etc. -}
|
{- Stores description for the repository etc. -}
|
||||||
start :: SubCmdStartString
|
start :: SubCmdStartString
|
||||||
|
|
|
@ -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.
|
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 (checking for unused data...) ok
|
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
|
||||||
|
|
Loading…
Reference in a new issue