better dup key with -J fix
This avoids all the complication about redundant work discussed in the previous try at fixing this. At the expense of needing each command that could have the problem to be patched to simply wrap the action in onlyActionOn once the key is known. But there do not seem to be many such commands. onlyActionOn' should not be used with a CommandStart (or CommandPerform), although the types do allow it. onlyActionOn handles running the whole CommandStart chain. I couldn't immediately see a way to avoid mistken use of onlyActionOn'. This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
68a49adcda
commit
e1ac299ad0
16 changed files with 82 additions and 77 deletions
|
@ -62,8 +62,8 @@ startKeys from key ai = checkFailedTransferDirection ai Download $
|
|||
start' (return True) from key (AssociatedFile Nothing) ai
|
||||
|
||||
start' :: Annex Bool -> Maybe Remote -> Key -> AssociatedFile -> ActionItem -> CommandStart
|
||||
start' expensivecheck from key afile ai = stopUnless (not <$> inAnnex key) $
|
||||
stopUnless expensivecheck $
|
||||
start' expensivecheck from key afile ai = onlyActionOn key $
|
||||
stopUnless (not <$> inAnnex key) $ stopUnless expensivecheck $
|
||||
case from of
|
||||
Nothing -> go $ perform key afile
|
||||
Just src ->
|
||||
|
@ -109,10 +109,9 @@ getKey' key afile = dispatch
|
|||
| Remote.hasKeyCheap r =
|
||||
either (const False) id <$> Remote.hasKey r key
|
||||
| otherwise = return True
|
||||
docopy r = download (Remote.uuid r) key afile forwardRetry $ \p ->
|
||||
ifM (inAnnex key)
|
||||
( return True
|
||||
, getViaTmp (RemoteVerify r) key $ \dest -> do
|
||||
docopy r witness = getViaTmp (RemoteVerify r) key $ \dest ->
|
||||
download (Remote.uuid r) key afile forwardRetry
|
||||
(\p -> do
|
||||
showAction $ "from " ++ Remote.name r
|
||||
Remote.retrieveKeyFile r key afile dest p
|
||||
)
|
||||
) witness
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue