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.
This commit is contained in:
Joey Hess 2014-08-20 20:08:45 -04:00
parent 9cb78e18ad
commit aebcc395ff
9 changed files with 35 additions and 31 deletions

View file

@ -28,8 +28,8 @@ start key = stopUnless (inAnnex key) $ do
next $ perform key
perform :: Key -> CommandPerform
perform key = lockContent key $ do
removeAnnex key
perform key = lockContent key $ \contentlock -> do
removeAnnex contentlock
next $ cleanup key
cleanup :: Key -> CommandCleanup