summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJeff Schumacher2010-07-12 14:48:56 (EDT)
committer Jeff Schumacher2010-07-12 15:54:01 (EDT)
commitbc08fafb411566522b232e37a2ec971db00676d6 (patch)
tree179f43700f7331a9724dc88b177ca1e9c8d0824b
parenta20e6f6fec7a696047df86f7d6a85863c4335d83 (diff)
downloadjgit-bc08fafb411566522b232e37a2ec971db00676d6.zip
jgit-bc08fafb411566522b232e37a2ec971db00676d6.tar.gz
jgit-bc08fafb411566522b232e37a2ec971db00676d6.tar.bz2
Added very small optimization to exact rename detectionrefs/changes/22/1122/2
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
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
index 04e669f..5bb63c4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
@@ -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) {