From 555e43961e2352c34ad86bceb07be279b11b656e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 13 Jun 2016 12:56:31 -0400 Subject: add test case for http://git-annex.branchable.com/bugs/Assistant_keeps_deleting_all_the_files_in_my_repo/ --- Test.hs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'Test.hs') 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 -- cgit v1.2.3