summaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-03 12:03:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-03 12:12:50 -0400
commitf5d0c8f0bf7f018479eb4da7e8c41598b7aacb7d (patch)
tree29bb0536642023b761f9c7188e2532749579e5f2 /Test.hs
parentf0c652b2a9ebc29e734316b8f87770fc8960aae2 (diff)
fix test suite to pass on windows
On windows, the sync of the second cloned repo to origin failed, because synced/master was a non-fast-forward. This may be a bug of its own, but it's not the issue that this test was intended to test, so disconnect the repos from origin before syncing.
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Test.hs b/Test.hs
index 09798abf1..581b36859 100644
--- a/Test.hs
+++ b/Test.hs
@@ -781,6 +781,7 @@ test_conflict_resolution_movein_bug env = withtmpclonerepo env False $ \r1 -> do
forM_ [r1, r2] $ \r -> indir env r $ do
{- Get all files, see check below. -}
git_annex env "get" [] @? "get failed"
+ disconnectOrigin
pair env r1 r2
forM_ [r1, r2] $ \r -> indir env r $ do
{- Set up a conflict. -}
@@ -815,10 +816,12 @@ test_mixed_conflict_resolution env = do
check_mixed_conflict inr1 = withtmpclonerepo env False $ \r1 ->
withtmpclonerepo env False $ \r2 -> do
indir env r1 $ do
+ disconnectOrigin
writeFile conflictor "conflictor"
git_annex env "add" [conflictor] @? "add conflicter failed"
git_annex env "sync" [] @? "sync failed in r1"
indir env r2 $ do
+ disconnectOrigin
createDirectory conflictor
writeFile (conflictor </> "subfile") "subfile"
git_annex env "add" [conflictor] @? "add conflicter failed"
@@ -838,16 +841,13 @@ test_mixed_conflict_resolution env = do
<$> getDirectoryContents d)
@? (d ++ "conflictor file missing")
-{- Set up repos as remotes of each other;
- - remove origin since we're going to sync
- - some changes to a file. -}
+{- Set up repos as remotes of each other. -}
pair :: TestEnv -> FilePath -> FilePath -> Assertion
pair env r1 r2 = forM_ [r1, r2] $ \r -> indir env r $ do
when (r /= r1) $
boolSystem "git" [Params "remote add r1", File ("../../" ++ r1)] @? "remote add"
when (r /= r2) $
boolSystem "git" [Params "remote add r2", File ("../../" ++ r2)] @? "remote add"
- boolSystem "git" [Params "remote rm origin"] @? "remote rm"
test_map :: TestEnv -> Assertion
test_map env = intmpclonerepo env $ do
@@ -1117,6 +1117,9 @@ withtmpclonerepo env bare a = do
dir <- tmprepodir
bracket (clonerepo env mainrepodir dir bare) cleanup a
+disconnectOrigin :: Assertion
+disconnectOrigin = boolSystem "git" [Params "remote rm origin"] @? "remote rm"
+
withgitrepo :: TestEnv -> (FilePath -> Assertion) -> Assertion
withgitrepo env = bracket (setuprepo env mainrepodir) return