summaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-04 14:41:32 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-04 14:50:28 -0400
commit73648a0c96a599b26b520125c26d35dbb15dead2 (patch)
tree8d58e8d4cb1f22bc19df09238f15ea37cc24ed95 /Test.hs
parent53518c58de6245763f570cbea0a84bbf7d1347eb (diff)
add test case for windows sync push failure
This adds a test for a failure mode seemingly specific to Windows that was removed in f5d0c8f0bf7f018479eb4da7e8c41598b7aacb7d, and puts it in its own test case.
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Test.hs b/Test.hs
index 3357c73be..8ff3a91d0 100644
--- a/Test.hs
+++ b/Test.hs
@@ -187,6 +187,7 @@ unitTests note getenv = testGroup ("Unit Tests " ++ note)
, check "sync" test_sync
, check "union merge regression" test_union_merge_regression
, check "conflict resolution" test_conflict_resolution_movein_bug
+ , check "sync push regression" test_sync_push_regression
, check "conflict_resolution (mixed directory and file)" test_mixed_conflict_resolution
, check "map" test_map
, check "uninit" test_uninit
@@ -743,6 +744,37 @@ test_sync env = intmpclonerepo env $ do
- sync committed the symlink standin file to the annex. -}
git_annex_expectoutput env "find" ["--in", "."] []
+test_sync_push_regression :: TestEnv -> Assertion
+test_sync_push_regression env = do
+ check_mixed_conflict True
+ check_mixed_conflict False
+ where
+ check_mixed_conflict inr1 = withtmpclonerepo env False $ \r1 ->
+ withtmpclonerepo env False $ \r2 -> do
+ indir env r1 $ do
+ writeFile conflictor "conflictor"
+ git_annex env "add" [conflictor] @? "add conflicter failed"
+ git_annex env "sync" [] @? "sync failed in r1"
+ indir env r2 $ do
+ createDirectory conflictor
+ writeFile (conflictor </> "subfile") "subfile"
+ git_annex env "add" [conflictor] @? "add conflicter failed"
+ git_annex env "sync" [] @? "sync failed in r2"
+ pair env r1 r2
+ let r = if inr1 then r1 else r2
+ indir env r $ do
+ git_annex env "sync" [] @? "sync failed in mixed conflict"
+ checkmerge r1
+ checkmerge r2
+ where
+ conflictor = "conflictor"
+ variantprefix = conflictor ++ ".variant"
+ checkmerge d = do
+ doesDirectoryExist (d </> conflictor) @? (d ++ " conflictor directory missing")
+ (any (variantprefix `isPrefixOf`)
+ <$> getDirectoryContents d)
+ @? (d ++ "conflictor file missing")
+
{- Regression test for union merge bug fixed in
- 0214e0fb175a608a49b812d81b4632c081f63027 -}
test_union_merge_regression :: TestEnv -> Assertion