summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorChris Aniszczyk <caniszczyk@gmail.com>2010-10-11 15:00:51 -0400
committerCode Review <codereview-daemon@eclipse.org>2010-10-11 15:00:51 -0400
commit033ab7f6f0f5501cc27866500f4f072dcafcc61e (patch)
treed9d636a38f77f6695864a730cd260d3a2d669355 /org.eclipse.jgit
parent4522b07d0f78174d632a3159a553f1e4c78c8408 (diff)
parent4fc50df97df55b1090d8ef5717805003527742cd (diff)
downloadjgit-033ab7f6f0f5501cc27866500f4f072dcafcc61e.tar.gz
jgit-033ab7f6f0f5501cc27866500f4f072dcafcc61e.zip
Merge changes I50dcec81,Ieab28bb3
* changes: Fix empty block corner case in PatienceDiff Fix infinite loop in PatienceDiff
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiff.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiffIndex.java15
2 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiff.java
index 571a498ae9..dfbf1a49b9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiff.java
@@ -182,6 +182,8 @@ public class PatienceDiff extends DiffAlgorithm {
break;
case EMPTY:
+ break;
+
default:
throw new IllegalStateException();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiffIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiffIndex.java
index 27cf9252e8..042abd2d71 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiffIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/PatienceDiffIndex.java
@@ -244,7 +244,7 @@ final class PatienceDiffIndex<S extends Sequence> {
private void scanA() {
int ptr = region.beginA;
final int end = region.endA;
- int pLast = pBegin - 1;
+ int pLast = pBegin;
SCAN: while (ptr < end) {
final int tIdx = hash(a, ptr);
@@ -276,12 +276,7 @@ final class PatienceDiffIndex<S extends Sequence> {
// fact that pCommon is sorted by B, and its likely that
// matches in A appear in the same order as they do in B.
//
- for (int pIdx = pLast + 1;; pIdx++) {
- if (pIdx == pEnd)
- pIdx = pBegin;
- else if (pIdx == pLast)
- break;
-
+ for (int pIdx = pLast;;) {
final long priorRec = pCommon[pIdx];
final int priorB = bOf(priorRec);
if (bs < priorB)
@@ -291,6 +286,12 @@ final class PatienceDiffIndex<S extends Sequence> {
pLast = pIdx;
continue SCAN;
}
+
+ pIdx++;
+ if (pIdx == pEnd)
+ pIdx = pBegin;
+ if (pIdx == pLast)
+ break;
}
}