aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/diff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-11-11 15:02:57 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-11-12 11:57:02 -0800
commitbc9bca064d9d41f11763a383aaca9c1710c61b4f (patch)
tree0304ef29d12810e8de5926c2713f42afd149bd66 /org.eclipse.jgit/src/org/eclipse/jgit/diff
parent05653bda04a8199fceacd7f8b26c8af4dd8a8f3a (diff)
downloadjgit-bc9bca064d9d41f11763a383aaca9c1710c61b4f.tar.gz
jgit-bc9bca064d9d41f11763a383aaca9c1710c61b4f.zip
RenameDetector: Only scan deletes if adds exist
If there are only deletes, don't need perform rename or copy detection. There are no adds (aka destinations) for the deletes to match against. Change-Id: I00fb90c509fa26a053de561dd8506cc1e0f5799a Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/diff')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java17
1 files changed, 8 insertions, 9 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 9d9a96d8df..dfaf5886e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
@@ -357,9 +357,17 @@ public class RenameDetector {
if (pm == null)
pm = NullProgressMonitor.INSTANCE;
+
+ if (0 < breakScore)
breakModifies(reader, pm);
+
+ if (!added.isEmpty() && !deleted.isEmpty())
findExactRenames(pm);
+
+ if (!added.isEmpty() && !deleted.isEmpty())
findContentRenames(reader, pm);
+
+ if (0 < breakScore && !added.isEmpty() && !deleted.isEmpty())
rejoinModifies(pm);
entries.addAll(added);
@@ -383,9 +391,6 @@ public class RenameDetector {
private void breakModifies(ContentSource.Pair reader, ProgressMonitor pm)
throws IOException {
- if (breakScore <= 0)
- return;
-
ArrayList<DiffEntry> newEntries = new ArrayList<DiffEntry>(entries.size());
pm.beginTask(JGitText.get().renamesBreakingModifies, entries.size());
@@ -469,9 +474,6 @@ public class RenameDetector {
ProgressMonitor pm)
throws IOException {
int cnt = Math.max(added.size(), deleted.size());
- if (cnt == 0)
- return;
-
if (getRenameLimit() == 0 || cnt <= getRenameLimit()) {
SimilarityRenameDetector d;
@@ -489,9 +491,6 @@ public class RenameDetector {
@SuppressWarnings("unchecked")
private void findExactRenames(ProgressMonitor pm) {
- if (added.isEmpty() || deleted.isEmpty())
- return;
-
pm.beginTask(JGitText.get().renamesFindingExact, //
added.size() + added.size() + deleted.size()
+ added.size() * deleted.size());