avoid starting a download for a local transfer when the remote already has the key

Turns out that recvkey already does this same check. This avoids a transfer
file being created for the download that never happened, which in turn
will avoid the assistant seeing that the download has finished, when no
transfer actually took place.
This commit is contained in:
Joey Hess 2012-09-18 13:59:03 -04:00
parent e6d4108fad
commit e9238e9588
2 changed files with 11 additions and 9 deletions

View file

@ -269,12 +269,15 @@ copyToRemote r key file
params <- rsyncParams r params <- rsyncParams r
u <- getUUID u <- getUUID
-- run copy from perspective of remote -- run copy from perspective of remote
liftIO $ onLocal r $ do liftIO $ onLocal r $ ifM (Annex.Content.inAnnex key)
( return False
, do
ensureInitialized ensureInitialized
download u key file $ download u key file $
Annex.Content.saveState True `after` Annex.Content.saveState True `after`
Annex.Content.getViaTmp key Annex.Content.getViaTmp key
(rsyncOrCopyFile params keysrc) (rsyncOrCopyFile params keysrc)
)
| Git.repoIsSsh r = commitOnCleanup r $ do | Git.repoIsSsh r = commitOnCleanup r $ do
keysrc <- inRepo $ gitAnnexLocation key keysrc <- inRepo $ gitAnnexLocation key
rsyncHelper =<< rsyncParamsRemote r False key keysrc file rsyncHelper =<< rsyncParamsRemote r False key keysrc file

View file

@ -36,10 +36,9 @@ all the other git clones, at both the git level and the key/value level.
that already has the content) and loop, until the git-annex branches catch that already has the content) and loop, until the git-annex branches catch
up and break the cycle. up and break the cycle.
Possible solution: C could record a download intent. (Similar to a failed Possible solution: C could record a deferred download. (Similar to a failed
download, but with an unknown source.) When C next receives a git-annex download, but with an unknown source.) When C next receives a git-annex
branch push, it could try to requeue downloads that it has such intents branch push, it could try to queue deferred downloads. **done**
registered for. **done**
Note that this solution won't cover use cases the other does. For example, Note that this solution won't cover use cases the other does. For example,
connect a USB drive A; B syncs files from it, and then should pass them to C. connect a USB drive A; B syncs files from it, and then should pass them to C.