add test of adding a second file with the same sha1
This commit is contained in:
parent
db9f44c8c7
commit
9d3ba00a15
1 changed files with 25 additions and 9 deletions
34
test.hs
34
test.hs
|
@ -94,15 +94,27 @@ test_init = "git-annex init" ~: TestCase $ innewrepo $ do
|
||||||
reponame = "test repo"
|
reponame = "test repo"
|
||||||
|
|
||||||
test_add :: Test
|
test_add :: Test
|
||||||
test_add = "git-annex add" ~: TestCase $ inmainrepo $ do
|
test_add = "git-annex add" ~: TestList [basic, sha1dup]
|
||||||
writeFile annexedfile $ content annexedfile
|
where
|
||||||
git_annex "add" ["-q", annexedfile] @? "add failed"
|
-- this test case runs in the main repo, to set up a basic
|
||||||
annexed_present annexedfile
|
-- annexed file that later tests will use
|
||||||
writeFile ingitfile $ content ingitfile
|
basic = TestCase $ inmainrepo $ do
|
||||||
Utility.boolSystem "git" ["add", ingitfile] @? "git add failed"
|
writeFile annexedfile $ content annexedfile
|
||||||
Utility.boolSystem "git" ["commit", "-q", "-a", "-m", "commit"] @? "git commit failed"
|
git_annex "add" ["-q", annexedfile] @? "add failed"
|
||||||
git_annex "add" ["-q", ingitfile] @? "add ingitfile should be no-op"
|
annexed_present annexedfile
|
||||||
unannexed ingitfile
|
writeFile ingitfile $ content ingitfile
|
||||||
|
Utility.boolSystem "git" ["add", ingitfile] @? "git add failed"
|
||||||
|
Utility.boolSystem "git" ["commit", "-q", "-a", "-m", "commit"] @? "git commit failed"
|
||||||
|
git_annex "add" ["-q", ingitfile] @? "add ingitfile should be no-op"
|
||||||
|
unannexed ingitfile
|
||||||
|
sha1dup = TestCase $ intmpclonerepo $ do
|
||||||
|
writeFile sha1annexedfile $ content sha1annexedfile
|
||||||
|
git_annex "add" ["-q", sha1annexedfile, "--backend=SHA1"] @? "add with SHA1 failed"
|
||||||
|
annexed_present sha1annexedfile
|
||||||
|
writeFile sha1annexedfiledup $ content sha1annexedfiledup
|
||||||
|
git_annex "add" ["-q", sha1annexedfiledup, "--backend=SHA1"] @? "add of second file with same SHA1 failed"
|
||||||
|
annexed_present sha1annexedfiledup
|
||||||
|
annexed_present sha1annexedfile
|
||||||
|
|
||||||
test_setkey :: Test
|
test_setkey :: Test
|
||||||
test_setkey = "git-annex setkey/fromkey" ~: TestCase $ inmainrepo $ do
|
test_setkey = "git-annex setkey/fromkey" ~: TestCase $ inmainrepo $ do
|
||||||
|
@ -647,6 +659,9 @@ annexedfile = "foo"
|
||||||
sha1annexedfile :: String
|
sha1annexedfile :: String
|
||||||
sha1annexedfile = "sha1foo"
|
sha1annexedfile = "sha1foo"
|
||||||
|
|
||||||
|
sha1annexedfiledup :: String
|
||||||
|
sha1annexedfiledup = "sha1foodup"
|
||||||
|
|
||||||
ingitfile :: String
|
ingitfile :: String
|
||||||
ingitfile = "bar"
|
ingitfile = "bar"
|
||||||
|
|
||||||
|
@ -655,6 +670,7 @@ content f
|
||||||
| f == annexedfile = "annexed file content"
|
| f == annexedfile = "annexed file content"
|
||||||
| f == ingitfile = "normal file content"
|
| f == ingitfile = "normal file content"
|
||||||
| f == sha1annexedfile ="sha1 annexed file content"
|
| f == sha1annexedfile ="sha1 annexed file content"
|
||||||
|
| f == sha1annexedfiledup = content sha1annexedfile
|
||||||
| otherwise = "unknown file " ++ f
|
| otherwise = "unknown file " ++ f
|
||||||
|
|
||||||
changecontent :: FilePath -> IO ()
|
changecontent :: FilePath -> IO ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue