summaryrefslogtreecommitdiff
path: root/test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-11 23:02:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-11 23:02:59 -0400
commit611018e4bd1a79becdbb58846f8faa7464a57a01 (patch)
tree9bd5b1eb5ee09cbd5b8a9e8ff5682a871b208327 /test.hs
parente18a4d566b4f205c8a60ddf79ce02ba023d34984 (diff)
I thought that reversion a migration might fail. It didn't. :)
Diffstat (limited to 'test.hs')
-rw-r--r--test.hs33
1 files changed, 25 insertions, 8 deletions
diff --git a/test.hs b/test.hs
index 417d830e8..6a8784d38 100644
--- a/test.hs
+++ b/test.hs
@@ -33,6 +33,7 @@ import qualified UUID
import qualified Remotes
import qualified Core
import qualified Backend.SHA1
+import qualified Backend.WORM
main :: IO ()
main = do
@@ -327,18 +328,34 @@ test_migrate = "git-annex migrate" ~: TestList [t False, t True]
annexed_present sha1annexedfile
if usegitattributes
then do
- writeFile ".gitattributes" "* annex.backend=SHA1"
- git_annex "migrate" ["-q", sha1annexedfile] @? "migrate to same backend failed"
- git_annex "migrate" ["-q", annexedfile] @? "migrate to different backend failed"
+ writeFile ".gitattributes" $ "* annex.backend=SHA1"
+ git_annex "migrate" ["-q", sha1annexedfile]
+ @? "migrate sha1annexedfile failed"
+ git_annex "migrate" ["-q", annexedfile]
+ @? "migrate annexedfile failed"
else do
- git_annex "migrate" [sha1annexedfile, "--backend=SHA1"] @? "migrate to same backend failed"
- git_annex "migrate" [annexedfile, "--backend=SHA1"] @? "migrate to different backend failed"
+ git_annex "migrate" ["-q", sha1annexedfile, "--backend", "SHA1"]
+ @? "migrate sha1annexedfile failed"
+ git_annex "migrate" ["-q", annexedfile, "--backend", "SHA1"]
+ @? "migrate annexedfile failed"
annexed_present annexedfile
annexed_present sha1annexedfile
- backend annexedfile Backend.SHA1.backend
- backend sha1annexedfile Backend.SHA1.backend
+ checkbackend annexedfile Backend.SHA1.backend
+ checkbackend sha1annexedfile Backend.SHA1.backend
+
+ -- check that reversing a migration works
+ writeFile ".gitattributes" $ "* annex.backend=WORM"
+ git_annex "migrate" ["-q", sha1annexedfile]
+ @? "migrate sha1annexedfile failed"
+ git_annex "migrate" ["-q", annexedfile]
+ @? "migrate annexedfile failed"
+ annexed_present annexedfile
+ annexed_present sha1annexedfile
+ checkbackend annexedfile Backend.WORM.backend
+ checkbackend sha1annexedfile Backend.WORM.backend
+
where
- backend file expected = do
+ checkbackend file expected = do
r <- annexeval $ Backend.lookupFile file
let b = snd $ fromJust r
assertEqual ("backend for " ++ file) expected b