summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-12-09 10:54:01 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-12-09 10:55:43 -0800
commit33c670c1f0d195833e8c9cbefb90d469848b62e2 (patch)
treeb0c98bfcee4957a4d0cb1c1fe708f6a196f8a0da /org.eclipse.jgit
parent1783749e169c57cef7131e1749a01ee269b89df8 (diff)
downloadjgit-33c670c1f0d195833e8c9cbefb90d469848b62e2.tar.gz
jgit-33c670c1f0d195833e8c9cbefb90d469848b62e2.zip
Simplify logic in StrategySimpleTwoWayInCore
Sasa and I were reviewing this code today and Sasa pointed out we can simplify the conflict logic, as the two cases (subtree and file) are logically identical. Change-Id: Ie0d40b2dd15605785eff453a846b1d20a2d021fc Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Reviewed-by: Sasa Zivkov <zivkov@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
index adb2278d89..d8a9423e8e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
@@ -131,7 +131,7 @@ public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy {
add(T_THEIRS, DirCacheEntry.STAGE_0);
else if (modeB == modeT && tw.idEqual(T_BASE, T_THEIRS))
add(T_OURS, DirCacheEntry.STAGE_0);
- else if (tw.isSubtree()) {
+ else {
if (nonTree(modeB)) {
add(T_BASE, DirCacheEntry.STAGE_1);
hasConflict = true;
@@ -144,12 +144,8 @@ public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy {
add(T_THEIRS, DirCacheEntry.STAGE_3);
hasConflict = true;
}
- tw.enterSubtree();
- } else {
- add(T_BASE, DirCacheEntry.STAGE_1);
- add(T_OURS, DirCacheEntry.STAGE_2);
- add(T_THEIRS, DirCacheEntry.STAGE_3);
- hasConflict = true;
+ if (tw.isSubtree())
+ tw.enterSubtree();
}
}
builder.finish();