summaryrefslogtreecommitdiff
path: root/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-04 17:45:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-04 19:35:55 -0400
commit34eb9b2fdc036e1dab4008751e88b312315928d1 (patch)
tree16ac8a3091a86f49f8c43b1486032f571a3d183e /Test.hs
parenta59665ca42c4215f0f1a66f0bbcc9618fa0e53e7 (diff)
sync: Automatically resolve merge conflict between and annexed file and a regular git file.
This is a new feature, it was not handled before, since it's a bit of an edge case. However, it can be handled exactly the same as a file/dir conflict, just leave the non-annexed item alone. While implementing this, the core resolveMerge' function got a lot simpler and clearer. Note especially that where before there was an asymetric call to stagefromdirectmergedir, now graftin is called symmetrically in both cases. And, in order to add that `graftin us`, the current branch needed to be known (if there is no current branch, there cannot be a merge conflict). This led to some cleanups of how autoMergeFrom behaved when there is no current branch. This commit was sponsored by Philippe Gauthier.
Diffstat (limited to 'Test.hs')
-rw-r--r--Test.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Test.hs b/Test.hs
index 238435c57..48b103b0b 100644
--- a/Test.hs
+++ b/Test.hs
@@ -925,8 +925,8 @@ test_nonannexed_conflict_resolution env = do
when switchdirect $
git_annex env "direct" [] @? "failed switching to direct mode"
git_annex env "sync" [] @? "sync failed"
- checkmerge "r1" r1
- checkmerge "r2" r2
+ checkmerge ("r1" ++ show switchdirect) r1
+ checkmerge ("r2" ++ show switchdirect) r2
conflictor = "conflictor"
nonannexed_content = "nonannexed"
variantprefix = conflictor ++ ".variant"
@@ -936,8 +936,9 @@ test_nonannexed_conflict_resolution env = do
not (null v)
@? (what ++ " conflictor variant file missing in: " ++ show l )
conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)
- s <- readFile (d </> conflictor)
- s == nonannexed_content @? (what ++ " wrong content for nonannexed file: " ++ s)
+ s <- catchMaybeIO (readFile (d </> conflictor))
+ s == Just nonannexed_content
+ @? (what ++ " wrong content for nonannexed file: " ++ show s)
{- Check merge conflict resolution when there is a local file,
- that is not staged or committed, that conflicts with what's being added