writeTrashFile("1", "1\n2\n3side2");
git.commit().setAll(true)
.setMessage("modified 1 on side again").call();
MergeResult result = git.merge().setStrategy(strategy)
.include(masterCommit).call();
assertEquals(MergeStatus.MERGED, result.getMergeStatus());
result.getNewHead();
git.checkout().setName("master").call();
result = git.merge().setStrategy(strategy).include(sideCommit).call();
assertEquals(MergeStatus.MERGED, result.getMergeStatus());
// we have two branches which are criss-cross merged. Try to merge the
// tips. This should succeed with RecursiveMerge and fail with
// ResolveMerge
try {
MergeResult mergeResult = git.merge().setStrategy(strategy)
.include(git.getRepository().getRef("refs/heads/side"))
.call();
assertEquals(MergeStrategy.RECURSIVE, strategy);
assertEquals(MergeResult.MergeStatus.MERGED,
mergeResult.getMergeStatus());
assertEquals("1master2\n2\n3side2\n", read("1"));
} catch (JGitInternalException e) {
assertEquals(MergeStrategy.RESOLVE, strategy);
assertTrue(e.getCause() instanceof NoMergeBaseException);
assertEquals(((NoMergeBaseException) e.getCause()).getReason(),