]> source.dussan.org Git - jgit.git/commitdiff
Merge branch 'rename-bug' 61/1261/1
authorShawn O. Pearce <spearce@spearce.org>
Fri, 6 Aug 2010 16:48:50 +0000 (09:48 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 6 Aug 2010 16:48:50 +0000 (09:48 -0700)
* rename-bug:
  Fix ArrayIndexOutOfBounds on non-square exact rename matrix

Conflicts:
org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java

Change-Id: Ie0b8dd3e1ec174f79ba39dc4706bb0694cc8be29

1  2 
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java

index 3ae3dc422cb1b23df7601f1d129f7b81dbb480d1,ad37a73721194b796141f0831ae422377700d086..9c1310ab812d03bc7e9caebc76c3a600f4058f80
@@@ -508,14 -390,14 +508,14 @@@ public class RenameDetector 
                                List<DiffEntry> dels = (List<DiffEntry>) o;
                                long[] matrix = new long[dels.size() * adds.size()];
                                int mNext = 0;
-                               for (int addIdx = 0; addIdx < adds.size(); addIdx++) {
-                                       String addedName = adds.get(addIdx).newPath;
+                               for (int delIdx = 0; delIdx < dels.size(); delIdx++) {
 -                                      String deletedName = dels.get(delIdx).oldName;
++                                      String deletedName = dels.get(delIdx).oldPath;
  
-                                       for (int delIdx = 0; delIdx < dels.size(); delIdx++) {
-                                               String deletedName = dels.get(delIdx).oldPath;
+                                       for (int addIdx = 0; addIdx < adds.size(); addIdx++) {
 -                                              String addedName = adds.get(addIdx).newName;
++                                              String addedName = adds.get(addIdx).newPath;
  
                                                int score = SimilarityRenameDetector.nameScore(addedName, deletedName);
-                                               matrix[mNext] = SimilarityRenameDetector.encode(score, addIdx, delIdx);
+                                               matrix[mNext] = SimilarityRenameDetector.encode(score, delIdx, addIdx);
                                                mNext++;
                                        }
                                }