summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-18 13:59:03 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-18 13:59:03 -0400
commite9238e958877dff9d12a5a0ed396e93931de95ce (patch)
treeb6bcec28853270ec2d6624754bfa219c462e70c1
parente6d4108fadcabf630e90012bab83107eaba040f2 (diff)
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.
-rw-r--r--Remote/Git.hs15
-rw-r--r--doc/design/assistant/syncing.mdwn5
2 files changed, 11 insertions, 9 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 49f040cc8..06e9ef1eb 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -269,12 +269,15 @@ copyToRemote r key file
params <- rsyncParams r
u <- getUUID
-- run copy from perspective of remote
- liftIO $ onLocal r $ do
- ensureInitialized
- download u key file $
- Annex.Content.saveState True `after`
- Annex.Content.getViaTmp key
- (rsyncOrCopyFile params keysrc)
+ liftIO $ onLocal r $ ifM (Annex.Content.inAnnex key)
+ ( return False
+ , do
+ ensureInitialized
+ download u key file $
+ Annex.Content.saveState True `after`
+ Annex.Content.getViaTmp key
+ (rsyncOrCopyFile params keysrc)
+ )
| Git.repoIsSsh r = commitOnCleanup r $ do
keysrc <- inRepo $ gitAnnexLocation key
rsyncHelper =<< rsyncParamsRemote r False key keysrc file
diff --git a/doc/design/assistant/syncing.mdwn b/doc/design/assistant/syncing.mdwn
index b9c6016b2..7a445b353 100644
--- a/doc/design/assistant/syncing.mdwn
+++ b/doc/design/assistant/syncing.mdwn
@@ -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
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
- branch push, it could try to requeue downloads that it has such intents
- registered for. **done**
+ branch push, it could try to queue deferred downloads. **done**
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.