summaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-13 12:56:31 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-13 12:59:10 -0400
commit555e43961e2352c34ad86bceb07be279b11b656e (patch)
treecf50f343f68e6a74eb3cfa3fc0d704905a3ca599 /Test.hs
parent4f5e61471afa7ad8e4ea63f8abef704a53ce1cce (diff)
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs29
1 files changed, 28 insertions, 1 deletions
diff --git a/Test.hs b/Test.hs
index 93f63dd9a..f92d825d0 100644
--- a/Test.hs
+++ b/Test.hs
@@ -232,6 +232,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
, testCase "version" test_version
, testCase "sync" test_sync
, testCase "union merge regression" test_union_merge_regression
+ , testCase "adjusted branch merge regression" test_adjusted_branch_merge_regression
, testCase "conflict resolution" test_conflict_resolution
, testCase "conflict resolution (adjusted branch)" test_conflict_resolution_adjusted_branch
, testCase "conflict resolution movein regression" test_conflict_resolution_movein_regression
@@ -1390,13 +1391,39 @@ test_mixed_lock_conflict_resolution =
let v = filter (variantprefix `isPrefixOf`) l
length v == 0
@? (what ++ " not exactly 0 variant files in: " ++ show l)
- void $ boolSystem "sh" [Param "-l"]
conflictor `elem` l @? ("conflictor not present after conflict resolution")
git_annex "get" [conflictor] @? "get failed"
git_annex_expectoutput "find" [conflictor] [conflictor]
-- regular file because it's unlocked
checkregularfile conflictor
+{- Regression test for a bad merge between two adjusted branch repos,
+ - where the same file is added to both independently. The bad merge
+ - emptied the whole tree. -}
+test_adjusted_branch_merge_regression :: Assertion
+test_adjusted_branch_merge_regression = whenM Annex.AdjustedBranch.isGitVersionSupported $
+ withtmpclonerepo $ \r1 ->
+ withtmpclonerepo $ \r2 -> do
+ pair r1 r2
+ setup r1
+ setup r2
+ checkmerge "r1" r1
+ checkmerge "r2" r2
+ where
+ conflictor = "conflictor"
+ setup r = indir r $ do
+ disconnectOrigin
+ git_annex "upgrade" [] @? "upgrade failed"
+ git_annex "adjust" ["--unlock", "--force"] @? "adjust failed"
+ writeFile conflictor "conflictor"
+ git_annex "add" [conflictor] @? "add conflicter failed"
+ git_annex "sync" [] @? "sync failed"
+ checkmerge what d = indir d $ do
+ git_annex "sync" [] @? ("sync failed in " ++ what)
+ l <- getDirectoryContents "."
+ conflictor `elem` l
+ @? ("conflictor not present after merge in " ++ what)
+
{- Set up repos as remotes of each other. -}
pair :: FilePath -> FilePath -> Assertion
pair r1 r2 = forM_ [r1, r2] $ \r -> indir r $ do