summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki <kevin@github.com>2012-05-09 14:31:59 -0700
committerKevin Sawicki <kevin@github.com>2012-05-09 14:31:59 -0700
commitc403d0b1873c96782eb0dbe02a14c34b82f7fce3 (patch)
treec3d6e79a4d2984493423bc41b24303be71eb4430
parent17fb542e9eaca9dffc4c84a6d23608dadb4b1ea1 (diff)
downloadjgit-c403d0b1873c96782eb0dbe02a14c34b82f7fce3.tar.gz
jgit-c403d0b1873c96782eb0dbe02a14c34b82f7fce3.zip
Compare modes before comparing ids in ResolveMerger
Comparing ids can be more expensive so do the cheap mode check first and short circuit the id comparison when modes are non-equal Change-Id: I671eda51c74a411cc27de9d6077cc76e816ebe2b
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 339dbdda41..261aa9f0a8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -556,7 +556,7 @@ public class ResolveMerger extends ThreeWayMerger {
// Index entry has to match ours to be considered clean
final boolean isDirty = nonTree(modeI)
- && !(tw.idEqual(T_INDEX, T_OURS) && modeO == modeI);
+ && !(modeO == modeI && tw.idEqual(T_INDEX, T_OURS));
if (isDirty)
failingPaths
.put(tw.getPathString(), MergeFailureReason.DIRTY_INDEX);
@@ -572,7 +572,7 @@ public class ResolveMerger extends ThreeWayMerger {
// Worktree entry has to match ours to be considered clean
final boolean isDirty = nonTree(modeF)
- && !(tw.idEqual(T_FILE, T_OURS) && modeO == modeF);
+ && !(modeO == modeF && tw.idEqual(T_FILE, T_OURS));
if (isDirty)
failingPaths.put(tw.getPathString(),
MergeFailureReason.DIRTY_WORKTREE);