summaryrefslogtreecommitdiff
path: root/Command/TestRemote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-20 20:08:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-20 20:13:47 -0400
commit28ac29b518a49363788b3607130cee5aff5534e9 (patch)
tree25985e4f7937c64e662ef5447651f4e44d2b9cbf /Command/TestRemote.hs
parent6f8f6b7dde108168ac5a9f0b3fb2cb8ea2d2f60c (diff)
use types to enforce that removeAnnex can only be called inside lockContent
This fixed one bug where it needed to be and wasn't (in Assistant.Unused). And also found one place where lockContent was used unnecessarily (by drop --from remote). A few other places like uninit probably don't really need to lockContent, but it doesn't hurt to do call it anyway. This commit was sponsored by David Wagner.
Diffstat (limited to 'Command/TestRemote.hs')
-rw-r--r--Command/TestRemote.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Command/TestRemote.hs b/Command/TestRemote.hs
index 3e1933d21..1cb1929e0 100644
--- a/Command/TestRemote.hs
+++ b/Command/TestRemote.hs
@@ -114,7 +114,7 @@ test st r k =
, check "storeKey when already present" store
, present True
, check "retrieveKeyFile" $ do
- removeAnnex k
+ lockContent k removeAnnex
get
, check "fsck downloaded object" fsck
, check "retrieveKeyFile resume from 33%" $ do
@@ -124,20 +124,20 @@ test st r k =
sz <- hFileSize h
L.hGet h $ fromInteger $ sz `div` 3
liftIO $ L.writeFile tmp partial
- removeAnnex k
+ lockContent k removeAnnex
get
, check "fsck downloaded object" fsck
, check "retrieveKeyFile resume from 0" $ do
tmp <- prepTmp k
liftIO $ writeFile tmp ""
- removeAnnex k
+ lockContent k removeAnnex
get
, check "fsck downloaded object" fsck
, check "retrieveKeyFile resume from end" $ do
loc <- Annex.calcRepo (gitAnnexLocation k)
tmp <- prepTmp k
void $ liftIO $ copyFileExternal loc tmp
- removeAnnex k
+ lockContent k removeAnnex
get
, check "fsck downloaded object" fsck
, check "removeKey when present" remove
@@ -183,7 +183,7 @@ testUnavailable st r k =
cleanup :: [Remote] -> [Key] -> Bool -> CommandCleanup
cleanup rs ks ok = do
forM_ rs $ \r -> forM_ ks (Remote.removeKey r)
- forM_ ks removeAnnex
+ forM_ ks $ \k -> lockContent k removeAnnex
return ok
chunkSizes :: Int -> Bool -> [Int]