From: Jeff Schumacher Date: Mon, 12 Jul 2010 18:48:56 +0000 (-0700) Subject: Added very small optimization to exact rename detection X-Git-Tag: v0.9.1~170^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F1122%2F2;p=jgit.git Added very small optimization to exact rename detection 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 --- 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 04e669ffe9..5bb63c4dd1 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 list = (List) 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) {