aboutsummaryrefslogtreecommitdiff
path: root/Command/Unlock.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-10 15:16:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-10 15:16:24 -0400
commit41868751a884bab79005f7c1d80e44672084e09a (patch)
treeb12abf0457c3437fc8f73cfa2cd85fa874a34358 /Command/Unlock.hs
parentc88874a89db54402dbf6bdd56f6d0306f4303e53 (diff)
unlock of not present file should still be a failure, just not a crash
Diffstat (limited to 'Command/Unlock.hs')
-rw-r--r--Command/Unlock.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/Command/Unlock.hs b/Command/Unlock.hs
index 8cc72f3a3..19a1b258f 100644
--- a/Command/Unlock.hs
+++ b/Command/Unlock.hs
@@ -26,12 +26,17 @@ seek = withFilesInGit $ whenAnnexed start
{- The unlock subcommand replaces the symlink with a copy of the file's
- content. -}
start :: FilePath -> Key -> CommandStart
-start file key = stopUnless (inAnnex key) $ do
+start file key = do
showStart "unlock" file
- ifM (checkDiskSpace Nothing key 0)
- ( next $ perform file key
+ ifM (inAnnex key)
+ ( ifM (checkDiskSpace Nothing key 0)
+ ( next $ perform file key
+ , do
+ warning "not enough disk space to copy file"
+ next $ next $ return False
+ )
, do
- warning "not enough disk space to copy file"
+ warning "content not present; cannot unlock"
next $ next $ return False
)