summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java2
2 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java
index 85b5eb7c0b..b8f8dcb5ad 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/AbstractDiffTestCase.java
@@ -191,7 +191,15 @@ public abstract class AbstractDiffTestCase {
public void testEdit_InsertNearCommonTail() {
EditList r = diff(t("aq}nb"), t("aCq}nD}nb"));
assertEquals(new Edit(1, 1, 1, 2), r.get(0));
- assertEquals(new Edit(3, 3, 4, 7), r.get(1));
+ assertEquals(new Edit(4, 4, 5, 8), r.get(1));
+ assertEquals(2, r.size());
+ }
+
+ @Test
+ public void testEdit_LinuxBug() {
+ EditList r = diff(t("a{bcdE}z"), t("a{0bcdEE}z"));
+ assertEquals(new Edit(2, 2, 2, 3), r.get(0));
+ assertEquals(new Edit(6, 6, 7, 8), r.get(1));
assertEquals(2, r.size());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java
index b20e3258b6..96f4d11857 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java
@@ -126,7 +126,7 @@ public abstract class DiffAlgorithm {
Edit last = e.get(e.size() - 1);
if (last.getType() == Edit.Type.INSERT) {
while (last.endB < b.size()
- && cmp.equals(b, last.beginB, b, region.endB)) {
+ && cmp.equals(b, last.beginB, b, last.endB)) {
last.beginA++;
last.endA++;
last.beginB++;