summaryrefslogtreecommitdiff
path: root/Command/DropKey.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/DropKey.hs')
-rw-r--r--Command/DropKey.hs17
1 files changed, 5 insertions, 12 deletions
diff --git a/Command/DropKey.hs b/Command/DropKey.hs
index b63d481bf..ae2ad8b6a 100644
--- a/Command/DropKey.hs
+++ b/Command/DropKey.hs
@@ -21,18 +21,11 @@ seek :: [CommandSeek]
seek = [withKeys start]
start :: Key -> CommandStart
-start key = do
- present <- inAnnex key
- if not present
- then stop
- else do
- checkforced
- showStart "dropkey" (show key)
- next $ perform key
- where
- checkforced =
- unlessM (Annex.getState Annex.force) $
- error "dropkey can cause data loss; use --force if you're sure you want to do this"
+start key = stopUnless (not <$> inAnnex key) $ do
+ unlessM (Annex.getState Annex.force) $
+ error "dropkey can cause data loss; use --force if you're sure you want to do this"
+ showStart "dropkey" (show key)
+ next $ perform key
perform :: Key -> CommandPerform
perform key = lockContent key $ do