unlock: Fix behavior when file content is not present.
This commit is contained in:
parent
23686cc63d
commit
c1839fdccb
3 changed files with 16 additions and 4 deletions
|
@ -12,6 +12,7 @@ import System.Directory hiding (copyFile)
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
import qualified Backend
|
||||||
import Types
|
import Types
|
||||||
import Messages
|
import Messages
|
||||||
import Locations
|
import Locations
|
||||||
|
@ -31,8 +32,12 @@ seek = [withFilesInGit start]
|
||||||
- content. -}
|
- content. -}
|
||||||
start :: CommandStartString
|
start :: CommandStartString
|
||||||
start file = isAnnexed file $ \(key, _) -> do
|
start file = isAnnexed file $ \(key, _) -> do
|
||||||
showStart "unlock" file
|
inbackend <- Backend.hasKey key
|
||||||
return $ Just $ perform file key
|
if not inbackend
|
||||||
|
then return Nothing
|
||||||
|
else do
|
||||||
|
showStart "unlock" file
|
||||||
|
return $ Just $ perform file key
|
||||||
|
|
||||||
perform :: FilePath -> Key -> CommandPerform
|
perform :: FilePath -> Key -> CommandPerform
|
||||||
perform dest key = do
|
perform dest key = do
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -5,6 +5,7 @@ git-annex (0.18) UNRELEASED; urgency=low
|
||||||
(Did not affect ssh remotes.)
|
(Did not affect ssh remotes.)
|
||||||
* fsck: Fix bug in moving of corrupted files to .git/annex/bad/
|
* fsck: Fix bug in moving of corrupted files to .git/annex/bad/
|
||||||
* migrate: Fix support for --backend option.
|
* migrate: Fix support for --backend option.
|
||||||
|
* unlock: Fix behavior when file content is not present.
|
||||||
* Test suite improvements. Current top-level test coverage: 80%
|
* Test suite improvements. Current top-level test coverage: 80%
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Tue, 11 Jan 2011 16:05:25 -0400
|
-- Joey Hess <joeyh@debian.org> Tue, 11 Jan 2011 16:05:25 -0400
|
||||||
|
|
10
test.hs
10
test.hs
|
@ -215,6 +215,12 @@ test_copy = "git-annex copy" ~: TestCase $ intmpclonerepo $ do
|
||||||
|
|
||||||
test_lock :: Test
|
test_lock :: Test
|
||||||
test_lock = "git-annex unlock/lock" ~: intmpclonerepo $ do
|
test_lock = "git-annex unlock/lock" ~: intmpclonerepo $ do
|
||||||
|
-- regression test: unlock of not present file should skip it
|
||||||
|
annexed_notpresent annexedfile
|
||||||
|
r <- git_annex "unlock" ["-q", annexedfile]
|
||||||
|
r @? "unlock failed with not present file"
|
||||||
|
annexed_notpresent annexedfile
|
||||||
|
|
||||||
git_annex "get" ["-q", annexedfile] @? "get of file failed"
|
git_annex "get" ["-q", annexedfile] @? "get of file failed"
|
||||||
annexed_present annexedfile
|
annexed_present annexedfile
|
||||||
git_annex "unlock" ["-q", annexedfile] @? "unlock failed"
|
git_annex "unlock" ["-q", annexedfile] @? "unlock failed"
|
||||||
|
@ -232,8 +238,8 @@ test_lock = "git-annex unlock/lock" ~: intmpclonerepo $ do
|
||||||
runchecks [checklink, checkunwritable] annexedfile
|
runchecks [checklink, checkunwritable] annexedfile
|
||||||
c <- readFile annexedfile
|
c <- readFile annexedfile
|
||||||
assertEqual ("content of modified file") c (changedcontent annexedfile)
|
assertEqual ("content of modified file") c (changedcontent annexedfile)
|
||||||
r <- git_annex "drop" ["-q", annexedfile]
|
r' <- git_annex "drop" ["-q", annexedfile]
|
||||||
(not r) @? "drop wrongly succeeded with no known copy of modified file"
|
not r' @? "drop wrongly succeeded with no known copy of modified file"
|
||||||
|
|
||||||
test_edit :: Test
|
test_edit :: Test
|
||||||
test_edit = "git-annex edit/commit" ~: TestList [t False, t True]
|
test_edit = "git-annex edit/commit" ~: TestList [t False, t True]
|
||||||
|
|
Loading…
Add table
Reference in a new issue