summaryrefslogtreecommitdiff
path: root/Command/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-10 23:35:08 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-10 23:45:14 -0400
commitb327227ba596d4fc5012138d03390c3eb861b808 (patch)
tree921c3ca6851d1ede45c387d9fd54997dcbf44906 /Command/Fsck.hs
parent4389782628a1cc683ef238e848b6311fc4bd82c3 (diff)
better limiting of start actions to only run whenAnnexed
Mostly only refactoring, but this does remove one redundant stat of the symlink by copy.
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r--Command/Fsck.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 89485b778..bdc509941 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -25,10 +25,13 @@ def :: [Command]
def = [command "fsck" paramPaths seek "check for problems"]
seek :: [CommandSeek]
-seek = [withNumCopies start, withBarePresentKeys startBare]
+seek =
+ [ withNumCopies $ \n -> whenAnnexed $ start n
+ , withBarePresentKeys startBare
+ ]
-start :: FilePath -> Maybe Int -> CommandStart
-start file numcopies = isAnnexed file $ \(key, backend) -> do
+start :: Maybe Int -> FilePath -> (Key, Backend Annex) -> CommandStart
+start numcopies file (key, backend) = do
showStart "fsck" file
next $ perform key file backend numcopies