]> source.dussan.org Git - jgit.git/commitdiff
Added very small optimization to exact rename detection 22/1122/2
authorJeff Schumacher <jeffschu@google.com>
Mon, 12 Jul 2010 18:48:56 +0000 (11:48 -0700)
committerJeff Schumacher <jeffschu@google.com>
Mon, 12 Jul 2010 19:54:01 +0000 (12:54 -0700)
Optimized a small loop in findExactRenames. The loop would go through
all the items in a list of DiffEntries even after it already found
what it was looking for. I made it break out of the loop as soon as
a good match was found.

Change-Id: I28741e0c49ce52d8008930a87cd1db7037700a61

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

index 04e669ffe9a7c050df4103184382d090d4839a29..5bb63c4dd1066d7f20858674f8ead661a46ed6a2 100644 (file)
@@ -351,8 +351,10 @@ public class RenameDetector {
                                List<DiffEntry> list = (List<DiffEntry>) del;
                                DiffEntry best = null;
                                for (DiffEntry e : list) {
-                                       if (best == null && sameType(e.oldMode, dst.newMode))
+                                       if (sameType(e.oldMode, dst.newMode)) {
                                                best = e;
+                                               break;
+                                       }
                                }
                                if (best != null) {
                                        if (best.changeType == ChangeType.DELETE) {