diff options
author | Joey Hess <joey@kitenet.net> | 2011-01-11 20:48:58 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-01-11 20:48:58 -0400 |
commit | b13039d62eb3a99606562f2edca7405b96776787 (patch) | |
tree | 16276ebf78089015aac614153ba1db5ccf3b84d2 | |
parent | 868486c6b6bad4614dcc6cad5a2e29f85833f967 (diff) |
test precommit; 74%
-rw-r--r-- | test.hs | 36 |
1 files changed, 23 insertions, 13 deletions
@@ -231,19 +231,29 @@ test_lock = "git-annex unlock/lock" ~: intmpclonerepo $ do (not r) @? "drop wrongly succeeded with no known copy of modified file" test_edit :: Test -test_edit = "git-annex edit/commit" ~: intmpclonerepo $ do - git_annex "get" ["-q", annexedfile] @? "get of file failed" - annexed_present annexedfile - git_annex "edit" ["-q", annexedfile] @? "edit failed" - unannexed annexedfile - changecontent annexedfile - Utility.boolSystem "git" ["commit", "-q", "-a", "-m", "content changed"] - @? "git commit of edited file failed" - runchecks [checklink, checkunwritable] annexedfile - c <- readFile annexedfile - assertEqual ("content of modified file") c (changedcontent annexedfile) - r <- git_annex "drop" ["-q", annexedfile] - (not r) @? "drop wrongly succeeded with no known copy of modified file" +test_edit = "git-annex edit/commit" ~: TestList [t False, t True] + where t precommit = TestCase $ intmpclonerepo $ do + git_annex "get" ["-q", annexedfile] @? "get of file failed" + annexed_present annexedfile + git_annex "edit" ["-q", annexedfile] @? "edit failed" + unannexed annexedfile + changecontent annexedfile + if precommit + then do + -- pre-commit depends on the file being + -- staged, normally git commit does this + Utility.boolSystem "git" ["add", annexedfile] + @? "git add of edited file failed" + git_annex "pre-commit" ["-q"] + @? "pre-commit failed" + else do + Utility.boolSystem "git" ["commit", "-q", "-a", "-m", "content changed"] + @? "git commit of edited file failed" + runchecks [checklink, checkunwritable] annexedfile + c <- readFile annexedfile + assertEqual ("content of modified file") c (changedcontent annexedfile) + r <- git_annex "drop" ["-q", annexedfile] + (not r) @? "drop wrongly succeeded with no known copy of modified file" test_fix :: Test test_fix = "git-annex fix" ~: intmpclonerepo $ do |