checkpresentkey: fix behavior to match documentation
checkpresentkey: When no remote is specified, try all remotes, not only ones that the location log says contain the key. This is what the documentation has always said it did. Still try the logged remotes first, because they are far more likely to have the key.
This commit is contained in:
parent
f3010afbf6
commit
c4f2c56f5e
4 changed files with 38 additions and 2 deletions
|
@ -9,6 +9,7 @@ module Command.CheckPresentKey where
|
|||
|
||||
import Command
|
||||
import qualified Remote
|
||||
import Remote.List
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ noMessages $
|
||||
|
@ -46,8 +47,13 @@ data Result = Present | NotPresent | CheckFailure String
|
|||
|
||||
check :: String -> Maybe Remote -> Annex Result
|
||||
check ks mr = case mr of
|
||||
Nothing -> go Nothing =<< Remote.keyPossibilities k
|
||||
Just r -> go Nothing [r]
|
||||
Nothing -> do
|
||||
mostlikely <- Remote.keyPossibilities k
|
||||
otherremotes <- flip Remote.remotesWithoutUUID
|
||||
(map Remote.uuid mostlikely)
|
||||
<$> remoteList
|
||||
go Nothing (mostlikely ++ otherremotes)
|
||||
where
|
||||
k = toKey ks
|
||||
go Nothing [] = return NotPresent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue