aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2010-11-02 17:39:59 +0100
committerChristian Halstrick <christian.halstrick@sap.com>2010-11-02 18:29:35 +0100
commit99771f04bcb6b1a79d4b9c5edff21c994104f8da (patch)
tree2c78371891519ccb06b715e54876544c49eff65a /org.eclipse.jgit.test/tst/org/eclipse
parente8642b538c950ad17b3f67c3bf75306b8f78b545 (diff)
downloadjgit-99771f04bcb6b1a79d4b9c5edff21c994104f8da.tar.gz
jgit-99771f04bcb6b1a79d4b9c5edff21c994104f8da.zip
Fixed merge algorithm regarding adjacent modifications
JGit merge algorithm behaved differently from C Git when we had adjacent modifications. If line 9 was modified by OURS and line 10 by theirs then C Git will return a conflict while JGit was seeing this as independent modifications. This change is not only there to achieve compatibility, but there where also some really wrong merge results produced by JGit in the area of adjacent modifications. Change-Id: I8d77cb59e82638214e45b3cf9ce3a1f1e9b35c70 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
index c929629502..9b4b7146f6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
@@ -107,7 +107,7 @@ public class MergeAlgorithmTest extends TestCase {
* @throws IOException
*/
public void testTwoComplicatedModifications() throws IOException {
- assertEquals(t("a<ZZZZfZh=bYdYYYY>ZY"),
+ assertEquals(t("a<ZZZZfZhZj=bYdYYYYiY>"),
merge("abcdefghij", "aZZZZfZhZj", "abYdYYYYiY"));
}
@@ -153,6 +153,18 @@ public class MergeAlgorithmTest extends TestCase {
merge("abcdefghij", "abdefghij", "abZdefghij"));
}
+ public void testInsertVsModify() throws IOException {
+ assertEquals(t("a<bZ=XY>"), merge("ab", "abZ", "aXY"));
+ }
+
+ public void testAdjacentModifications() throws IOException {
+ assertEquals(t("a<Zc=bY>d"), merge("abcd", "aZcd", "abYd"));
+ }
+
+ public void testSeperateModifications() throws IOException {
+ assertEquals(t("aZcYe"), merge("abcde", "aZcde", "abcYe"));
+ }
+
private String merge(String commonBase, String ours, String theirs) throws IOException {
MergeResult r = MergeAlgorithm.merge(RawTextComparator.DEFAULT,
T(commonBase), T(ours), T(theirs));