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.
This commit is contained in:
Joey Hess 2014-08-04 09:16:47 -04:00
parent 00c1468160
commit 6cecffea89

View file

@ -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