summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-14 16:01:40 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-14 16:01:40 -0400
commit59fe0b29a6f15a61276702e1594b9476e1363fd9 (patch)
treeac688f24e80e8958730abc9acd7dde63a027b0c6
parent11994ebb3dc50a74dea9601907493950ac3540a4 (diff)
simplify
-rw-r--r--Command/Drop.hs4
-rw-r--r--Command/Fsck.hs4
-rw-r--r--Command/Optimize.hs3
3 files changed, 3 insertions, 8 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 8afffd3cb..a18729940 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -34,10 +34,8 @@ start (file, attr) = isAnnexed file $ \(key, _) -> do
if present
then do
showStart "drop" file
- next $ perform key numcopies
+ next $ perform key $ readMaybe attr
else stop
- where
- numcopies = readMaybe attr :: Maybe Int
perform :: Key -> Maybe Int -> CommandPerform
perform key numcopies = do
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index cdc68581e..08bf2b97f 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -39,9 +39,7 @@ seek = [withNumCopies start]
start :: CommandStartAttrFile
start (file, attr) = notBareRepo $ isAnnexed file $ \(key, backend) -> do
showStart "fsck" file
- next $ perform key file backend numcopies
- where
- numcopies = readMaybe attr :: Maybe Int
+ next $ perform key file backend $ readMaybe attr
perform :: Key -> FilePath -> Backend Annex -> Maybe Int -> CommandPerform
perform key file backend numcopies = do
diff --git a/Command/Optimize.hs b/Command/Optimize.hs
index 40625fc2f..1a2b2237f 100644
--- a/Command/Optimize.hs
+++ b/Command/Optimize.hs
@@ -24,7 +24,7 @@ seek = [withNumCopies start]
start :: CommandStartAttrFile
start p@(file, attr) = notBareRepo $ isAnnexed file $ \(key, _) -> do
- needed <- getNumCopies numcopies
+ needed <- getNumCopies $ readMaybe attr
(_, safelocations) <- trustPartition UnTrusted =<< keyLocations key
dispatch needed (length safelocations)
where
@@ -32,4 +32,3 @@ start p@(file, attr) = notBareRepo $ isAnnexed file $ \(key, _) -> do
| present < needed = Command.Get.start file
| present > needed = Command.Drop.start p
| otherwise = stop
- numcopies = readMaybe attr :: Maybe Int