aboutsummaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-10-11 14:22:49 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-10-11 14:22:49 -0400
commitce72696171a0bf212dfc8f40a5c6b875bf7e7692 (patch)
tree7e54f78829b08b06da84215d503c4733cfc908b1 /Test.hs
parent5d85a812205db3cbfb23ce47a38f35e773d299d8 (diff)
add test case for sync_in_adjusted_branch_deleted_recently_added_files
This commit was sponsored by Denis Dzyubenko on Patreon.
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/Test.hs b/Test.hs
index cd7118fe4..abd26e4ea 100644
--- a/Test.hs
+++ b/Test.hs
@@ -234,6 +234,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
, testCase "sync" test_sync
, testCase "union merge regression" test_union_merge_regression
, testCase "adjusted branch merge regression" test_adjusted_branch_merge_regression
+ , testCase "adjusted branch subtree regression" test_adjusted_branch_subtree_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
@@ -1425,6 +1426,27 @@ test_adjusted_branch_merge_regression = whenM Annex.AdjustedBranch.isGitVersionS
conflictor `elem` l
@? ("conflictor not present after merge in " ++ what)
+{- Regression test for a bug in adjusted branch syncing code, where adding
+ - a subtree to an existing tree lost files. -}
+test_adjusted_branch_subtree_regression :: Assertion
+test_adjusted_branch_subtree_regression =
+ whenM Annex.AdjustedBranch.isGitVersionSupported $
+ withtmpclonerepo $ \r -> do
+ indir r $ do
+ disconnectOrigin
+ git_annex "upgrade" [] @? "upgrade failed"
+ git_annex "adjust" ["--unlock", "--force"] @? "adjust failed"
+ createDirectoryIfMissing True "a/b/c"
+ writeFile "a/b/c/d" "foo"
+ git_annex "add" ["a/b/c"] @? "add a/b/c failed"
+ git_annex "sync" [] @? "sync failed"
+ createDirectoryIfMissing True "a/b/x"
+ writeFile "a/b/x/y" "foo"
+ git_annex "add" ["a/b/x"] @? "add a/b/x failed"
+ git_annex "sync" [] @? "sync failed"
+ boolSystem "git" [Param "checkout", Param "master"] @? "git checkout master failed"
+ doesFileExist "a/b/x/y" @? ("a/b/x/y missing from master after adjusted branch sync")
+
{- Set up repos as remotes of each other. -}
pair :: FilePath -> FilePath -> Assertion
pair r1 r2 = forM_ [r1, r2] $ \r -> indir r $ do