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 seek = withKeys start
start :: Key -> CommandStart start :: Key -> CommandStart
start key = ifM (inAnnex key) start key = fieldTransfer Download key $ \_p ->
( error "key is already present in annex" ifM (getViaTmp key go)
, fieldTransfer Download key $ \_p -> ( do
ifM (getViaTmp key go) -- forcibly quit after receiving one key,
( do -- and shutdown cleanly
-- forcibly quit after receiving one key, _ <- shutdown True
-- and shutdown cleanly return True
_ <- shutdown True , return False
return True )
, return False
)
)
where where
go tmp = do go tmp = do
opts <- filterRsyncSafeOptions . maybe [] words opts <- filterRsyncSafeOptions . maybe [] words