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
CHANGELOG
Command
doc/bugs
checkpresentkey_wrongly_reports_key_absense.mdwn
checkpresentkey_wrongly_reports_key_absense
|
@ -39,7 +39,9 @@ git-annex (8.20200523) UNRELEASED; urgency=medium
|
|||
remotes.
|
||||
* When a local git remote cannot be initialized because it has no
|
||||
git-annex branch or a .noannex file, avoid displaying a message about it.
|
||||
|
||||
* 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.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 26 May 2020 10:20:52 -0400
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -82,3 +82,5 @@ upgrade supported from repository versions: 0 1 2 3 4 5 6
|
|||
local repository version: 5
|
||||
|
||||
Linux ip-172-31-85-193 4.14.97-74.72.amzn1.x86_64 #1 SMP Tue Feb 5 20:59:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 2"""
|
||||
date="2020-06-16T17:35:41Z"
|
||||
content="""
|
||||
So I guess the problem description is:
|
||||
|
||||
checkpresentkey with the uuid of a remote verifies the key is on the
|
||||
remote, return 1. But, with no uuid, it's supposed to check all remotes,
|
||||
and instead it seems to fail and return 0 without checking the remote
|
||||
whose uuid the earlier run of it showed does contain the key.
|
||||
|
||||
And I think I see why it would do that. When no remote is given, it reads
|
||||
the location log, and checks each remote that the location log says
|
||||
contains the key. So, if the location log is out of date and a remote does
|
||||
contain the key, it will return 0 w/o checking it.
|
||||
|
||||
It would probably make sense for it to actually try all accessible remotes,
|
||||
on the off chance one of them has the key. That's what the documentation
|
||||
says it does, although I don't think it ever has.
|
||||
|
||||
The original use case for this was
|
||||
[[todo/checkpresentkey_without_explicit_remote]], and it does seem like
|
||||
that use case intended to check all remotes, not only ones the location log
|
||||
has it.
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue