From 50b340b84bee12ba1a19a747aef442594aedcbd4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 4 Aug 2014 09:16:47 -0400 Subject: 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. --- Command/RecvKey.hs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'Command') 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 -- cgit v1.2.3