From 3623d831d193d029a35aac81571d67768b176534 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Sep 2011 17:19:29 -0400 Subject: refactor --- Command/Fsck.hs | 6 +----- Command/Whereis.hs | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'Command') diff --git a/Command/Fsck.hs b/Command/Fsck.hs index bad60d30d..529a5015a 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -10,7 +10,6 @@ module Command.Fsck where import Control.Monad (when) import Control.Monad.State (liftIO) import System.Directory -import Data.List import System.Posix.Files import Command @@ -124,10 +123,7 @@ checkKeySize key = do checkKeyNumCopies :: Key -> Maybe FilePath -> Maybe Int -> Annex Bool checkKeyNumCopies key file numcopies = do needed <- getNumCopies numcopies - locations <- keyLocations key - untrusted <- trustGet UnTrusted - let untrustedlocations = intersect untrusted locations - let safelocations = filter (`notElem` untrusted) locations + (untrustedlocations, safelocations) <- trustPartition UnTrusted =<< keyLocations key let present = length safelocations if present < needed then do diff --git a/Command/Whereis.hs b/Command/Whereis.hs index d5c090e49..850975048 100644 --- a/Command/Whereis.hs +++ b/Command/Whereis.hs @@ -8,7 +8,6 @@ module Command.Whereis where import Control.Monad -import Data.List import LocationLog import Command @@ -32,9 +31,7 @@ start file = isAnnexed file $ \(key, _) -> do perform :: Key -> CommandPerform perform key = do locations <- keyLocations key - untrusted <- trustGet UnTrusted - let untrustedlocations = intersect untrusted locations - let safelocations = filter (`notElem` untrusted) locations + (untrustedlocations, safelocations) <- trustPartition UnTrusted locations let num = length safelocations showNote $ show num ++ " " ++ copiesplural num pp <- prettyPrintUUIDs "whereis" safelocations -- cgit v1.2.3