diff options
author | Denys Digtiar <duemir@gmail.com> | 2011-07-18 08:33:30 +0300 |
---|---|---|
committer | Chris Aniszczyk <zx@twitter.com> | 2011-08-21 13:53:02 -0700 |
commit | c580c56c4def9639b603553b3d4cbc7117a30938 (patch) | |
tree | d3801915c28f1baa1b3215e9eb691021d6c64614 /org.eclipse.jgit.test/tst | |
parent | e38cf2078d22e2c902a373371382ac8d82268f2d (diff) | |
download | jgit-c580c56c4def9639b603553b3d4cbc7117a30938.tar.gz jgit-c580c56c4def9639b603553b3d4cbc7117a30938.zip |
Fix ClassCastException in MergeCommand
Test was added which reproduce the ClassCastException when ours or
theirs merge strategy is set to MergeCommand. Merger and MergeCommand
were updated in order to avoid exception.
Change-Id: I4c1284b4e80d82638d0677a05e5d38182526d196
Signed-off-by: Denys Digtiar <duemir@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java index 7811706fc1..1c682cae10 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java @@ -62,8 +62,17 @@ import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.util.FileUtils; import org.junit.Test; +import org.junit.experimental.theories.DataPoints; +import org.junit.experimental.theories.Theories; +import org.junit.experimental.theories.Theory; +import org.junit.runner.RunWith; +@RunWith(Theories.class) public class MergeCommandTest extends RepositoryTestCase { + + public static @DataPoints + MergeStrategy[] mergeStrategies = MergeStrategy.get(); + @Test public void testMergeInItself() throws Exception { Git git = new Git(db); @@ -161,6 +170,28 @@ public class MergeCommandTest extends RepositoryTestCase { } } + @Theory + public void testMergeSuccessAllStrategies(MergeStrategy mergeStrategy) + throws Exception { + Git git = new Git(db); + + RevCommit first = git.commit().setMessage("first").call(); + createBranch(first, "refs/heads/side"); + + writeTrashFile("a", "a"); + git.add().addFilepattern("a").call(); + git.commit().setMessage("second").call(); + + checkoutBranch("refs/heads/side"); + writeTrashFile("b", "b"); + git.add().addFilepattern("b").call(); + git.commit().setMessage("third").call(); + + MergeResult result = git.merge().setStrategy(mergeStrategy) + .include(db.getRef(Constants.MASTER)).call(); + assertEquals(MergeStatus.MERGED, result.getMergeStatus()); + } + @Test public void testContentMerge() throws Exception { Git git = new Git(db); |