summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Lock.hs2
-rw-r--r--Test.hs6
2 files changed, 5 insertions, 3 deletions
diff --git a/Command/Lock.hs b/Command/Lock.hs
index 8b36e1cee..4e42a8d76 100644
--- a/Command/Lock.hs
+++ b/Command/Lock.hs
@@ -46,7 +46,7 @@ startNew file key = ifM (isJust <$> isAnnexLink file)
)
where
go (Just key')
- | key' == key = cont False
+ | key' == key = error "content not present; cannot lock"
| otherwise = errorModified
go Nothing =
ifM (isUnmodified key file)
diff --git a/Test.hs b/Test.hs
index fdb1404cb..5646f14e1 100644
--- a/Test.hs
+++ b/Test.hs
@@ -546,9 +546,11 @@ test_preferred_content = intmpclonerepo $ do
test_lock :: Assertion
test_lock = intmpclonerepoInDirect $ do
- -- regression test: unlock of not present file should skip it
annexed_notpresent annexedfile
- not <$> git_annex "unlock" [annexedfile] @? "unlock failed to fail with not present file"
+ ifM (unlockedFiles <$> getTestMode)
+ ( not <$> git_annex "lock" [annexedfile] @? "lock failed to fail with not present file"
+ , not <$> git_annex "unlock" [annexedfile] @? "unlock failed to fail with not present file"
+ )
annexed_notpresent annexedfile
-- regression test: unlock of newly added, not committed file