simplify
This commit is contained in:
parent
11994ebb3d
commit
59fe0b29a6
3 changed files with 3 additions and 8 deletions
|
@ -34,10 +34,8 @@ start (file, attr) = isAnnexed file $ \(key, _) -> do
|
||||||
if present
|
if present
|
||||||
then do
|
then do
|
||||||
showStart "drop" file
|
showStart "drop" file
|
||||||
next $ perform key numcopies
|
next $ perform key $ readMaybe attr
|
||||||
else stop
|
else stop
|
||||||
where
|
|
||||||
numcopies = readMaybe attr :: Maybe Int
|
|
||||||
|
|
||||||
perform :: Key -> Maybe Int -> CommandPerform
|
perform :: Key -> Maybe Int -> CommandPerform
|
||||||
perform key numcopies = do
|
perform key numcopies = do
|
||||||
|
|
|
@ -39,9 +39,7 @@ seek = [withNumCopies start]
|
||||||
start :: CommandStartAttrFile
|
start :: CommandStartAttrFile
|
||||||
start (file, attr) = notBareRepo $ isAnnexed file $ \(key, backend) -> do
|
start (file, attr) = notBareRepo $ isAnnexed file $ \(key, backend) -> do
|
||||||
showStart "fsck" file
|
showStart "fsck" file
|
||||||
next $ perform key file backend numcopies
|
next $ perform key file backend $ readMaybe attr
|
||||||
where
|
|
||||||
numcopies = readMaybe attr :: Maybe Int
|
|
||||||
|
|
||||||
perform :: Key -> FilePath -> Backend Annex -> Maybe Int -> CommandPerform
|
perform :: Key -> FilePath -> Backend Annex -> Maybe Int -> CommandPerform
|
||||||
perform key file backend numcopies = do
|
perform key file backend numcopies = do
|
||||||
|
|
|
@ -24,7 +24,7 @@ seek = [withNumCopies start]
|
||||||
|
|
||||||
start :: CommandStartAttrFile
|
start :: CommandStartAttrFile
|
||||||
start p@(file, attr) = notBareRepo $ isAnnexed file $ \(key, _) -> do
|
start p@(file, attr) = notBareRepo $ isAnnexed file $ \(key, _) -> do
|
||||||
needed <- getNumCopies numcopies
|
needed <- getNumCopies $ readMaybe attr
|
||||||
(_, safelocations) <- trustPartition UnTrusted =<< keyLocations key
|
(_, safelocations) <- trustPartition UnTrusted =<< keyLocations key
|
||||||
dispatch needed (length safelocations)
|
dispatch needed (length safelocations)
|
||||||
where
|
where
|
||||||
|
@ -32,4 +32,3 @@ start p@(file, attr) = notBareRepo $ isAnnexed file $ \(key, _) -> do
|
||||||
| present < needed = Command.Get.start file
|
| present < needed = Command.Get.start file
|
||||||
| present > needed = Command.Drop.start p
|
| present > needed = Command.Drop.start p
|
||||||
| otherwise = stop
|
| otherwise = stop
|
||||||
numcopies = readMaybe attr :: Maybe Int
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue