fix test failure locking an unlocked not present file
In v5, that was not possible, but it is in v6, and so the test was failing. Investigating, it turns out that locking was copying the pointer file content to the annex object despite the content not being present. So, add a check to prevent that.
This commit is contained in:
parent
d667a68b7e
commit
0c1cc7789f
2 changed files with 5 additions and 3 deletions
|
@ -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)
|
||||
|
|
6
Test.hs
6
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
|
||||
|
|
Loading…
Reference in a new issue