summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-04 09:16:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-04 09:16:47 -0400
commit50b340b84bee12ba1a19a747aef442594aedcbd4 (patch)
tree729e34c990812a782b1af560bb334fe36feecec4 /Command
parentf2213b0cb0b21dbbc651b4c869e85d7fd7f839bd (diff)
fix "storeKey when already present" test for git-annex-shell transfers
Now git-annex-shell recvkey, when the key is already present, allows another copy to be rsynced up, and just throws it away. This same behavior could have already happened before, when eg, two repos tried to upload the same object at the same time. So this makes the test suite pass, and should not add any bad behavior, other than slightly more work being done in a rather edge case. This relies on moveAnnex's behavior of keeping the current version of an object.
Diffstat (limited to 'Command')
-rw-r--r--Command/RecvKey.hs21
1 files changed, 9 insertions, 12 deletions
diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs
index 1794596c5..d5971d6cf 100644
--- a/Command/RecvKey.hs
+++ b/Command/RecvKey.hs
@@ -28,18 +28,15 @@ seek :: CommandSeek
seek = withKeys start
start :: Key -> CommandStart
-start key = ifM (inAnnex key)
- ( error "key is already present in annex"
- , fieldTransfer Download key $ \_p ->
- ifM (getViaTmp key go)
- ( do
- -- forcibly quit after receiving one key,
- -- and shutdown cleanly
- _ <- shutdown True
- return True
- , return False
- )
- )
+start key = fieldTransfer Download key $ \_p ->
+ ifM (getViaTmp key go)
+ ( do
+ -- forcibly quit after receiving one key,
+ -- and shutdown cleanly
+ _ <- shutdown True
+ return True
+ , return False
+ )
where
go tmp = do
opts <- filterRsyncSafeOptions . maybe [] words