aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-08-06 09:33:55 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-08-06 09:39:10 -0700
commite2f5716c940c5da22cbb3b0b08cb4ee7f2970580 (patch)
tree242c238e241dba2e3dfab21d50b0575d326caea4 /org.eclipse.jgit.test/tst/org/eclipse/jgit/diff
parente64cb0306507ce8a33d5f638cb4aa0ec9c1327ff (diff)
downloadjgit-e2f5716c940c5da22cbb3b0b08cb4ee7f2970580.tar.gz
jgit-e2f5716c940c5da22cbb3b0b08cb4ee7f2970580.zip
Fix ArrayIndexOutOfBounds on non-square exact rename matrix
If the exact rename matrix for a particular ObjectId isn't square we crashed with an ArrayIndexOutOfBoundsException because the matrix entries were encoded backwards. The encode function accepts the source (aka deleted) index first, not second. Add a unit test to cover this non-square case to ensure we don't have this regression in the future. Change-Id: I5b005e5093e1f00de2e3ec104e27ab6820203566 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/diff')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
index 6024c76998..b5d94c02c7 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
@@ -173,17 +173,20 @@ public class RenameDetectorTest extends RepositoryTestCase {
DiffEntry c = DiffEntry.add("c.txt", foo);
DiffEntry d = DiffEntry.delete("d.txt", foo);
+ DiffEntry e = DiffEntry.add("the_e_file.txt", foo);
// Add out of order to avoid first-match succeeding
rd.add(a);
rd.add(d);
+ rd.add(e);
rd.add(b);
rd.add(c);
List<DiffEntry> entries = rd.compute();
- assertEquals(2, entries.size());
+ assertEquals(3, entries.size());
assertRename(d, c, 100, entries.get(0));
assertRename(b, a, 100, entries.get(1));
+ assertCopy(d, e, 100, entries.get(2));
}
public void testExactRename_OneDeleteManyAdds() throws Exception {