summaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs21
1 files changed, 6 insertions, 15 deletions
diff --git a/Remote.hs b/Remote.hs
index 6295fc947..1accabf6d 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -131,19 +131,7 @@ remotesWithoutUUID rs us = filter (\r -> uuid r `notElem` us) rs
{- Cost ordered lists of remotes that the LocationLog indicate may have a key.
-}
keyPossibilities :: Key -> Annex [Remote Annex]
-keyPossibilities key = do
- g <- Annex.gitRepo
- u <- getUUID g
-
- -- get uuids of all remotes that are recorded to have the key
- uuids <- keyLocations key
- let validuuids = filter (/= u) uuids
-
- -- remotes that match uuids that have the key
- allremotes <- genList
- let validremotes = remotesWithUUID allremotes validuuids
-
- return $ sort validremotes
+keyPossibilities key = return . fst =<< keyPossibilities' False key
{- Cost ordered lists of remotes that the LocationLog indicate may have a key.
-
@@ -151,10 +139,13 @@ keyPossibilities key = do
- (some may not have configured remotes).
-}
keyPossibilitiesTrusted :: Key -> Annex ([Remote Annex], [UUID])
-keyPossibilitiesTrusted key = do
+keyPossibilitiesTrusted = keyPossibilities' True
+
+keyPossibilities' :: Bool -> Key -> Annex ([Remote Annex], [UUID])
+keyPossibilities' withtrusted key = do
g <- Annex.gitRepo
u <- getUUID g
- trusted <- trustGet Trusted
+ trusted <- if withtrusted then trustGet Trusted else return []
-- get uuids of all remotes that are recorded to have the key
uuids <- keyLocations key