aboutsummaryrefslogtreecommitdiff
path: root/Command/Unlock.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/Unlock.hs')
-rw-r--r--Command/Unlock.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Command/Unlock.hs b/Command/Unlock.hs
index 7c1625bf0..4bd6e8599 100644
--- a/Command/Unlock.hs
+++ b/Command/Unlock.hs
@@ -7,6 +7,7 @@
module Command.Unlock where
+import Control.Monad (when)
import Control.Monad.State (liftIO)
import System.Directory hiding (copyFile)
@@ -32,15 +33,15 @@ seek = [withFilesInGit start]
- content. -}
start :: CommandStartString
start file = isAnnexed file $ \(key, _) -> do
- inbackend <- Backend.hasKey key
- if not inbackend
- then return Nothing
- else do
- showStart "unlock" file
- return $ Just $ perform file key
+ showStart "unlock" file
+ return $ Just $ perform file key
perform :: FilePath -> Key -> CommandPerform
perform dest key = do
+ inbackend <- Backend.hasKey key
+ when (not inbackend) $
+ error "content not present"
+
g <- Annex.gitRepo
let src = annexLocation g key
liftIO $ removeFile dest