diff options
author | Bernard Leach <leachbj@bouncycastle.org> | 2011-04-29 19:37:00 +1000 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-05-03 12:11:52 -0500 |
commit | 98b019f4bdc45bd122e4d81009c4e814350e051c (patch) | |
tree | a6b3198d29e4a5557f1757ce21fb53517fd762fd /org.eclipse.jgit | |
parent | 04df086d3e2564b06d2a462449942fcf6e71421b (diff) | |
download | jgit-98b019f4bdc45bd122e4d81009c4e814350e051c.tar.gz jgit-98b019f4bdc45bd122e4d81009c4e814350e051c.zip |
Implemented merge for parallel delete/modification
Duplicates cgit behaviour for merging the case where
OURS is deleted and THEIRS is modified as well as
OURS is modified and THEIRS id deleted.
Change-Id: Ia2ab4f8dc95020f2914ff01c2bf3b1bc62a9d45d
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java | 23 |
1 files changed, 23 insertions, 0 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 cf969107d8..8758427583 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -452,6 +452,29 @@ public class ResolveMerger extends ThreeWayMerger { unmergedPaths.add(tw.getPathString()); } modifiedFiles.add(tw.getPathString()); + } else if (modeO != modeT) { + // OURS or THEIRS has been deleted + if (((modeO != 0 && !tw.idEqual(T_BASE, T_OURS)) || (modeT != 0 && !tw + .idEqual(T_BASE, T_THEIRS)))) { + + add(tw.getRawPath(), base, DirCacheEntry.STAGE_1); + add(tw.getRawPath(), ours, DirCacheEntry.STAGE_2); + DirCacheEntry e = add(tw.getRawPath(), theirs, + DirCacheEntry.STAGE_3); + + // OURS was deleted checkout THEIRS + if (modeO == 0) { + // Check worktree before checking out THEIRS + if (isWorktreeDirty()) + return false; + if (nonTree(modeT)) { + if (e != null) + toBeCheckedOut.put(tw.getPathString(), e); + } + } + + unmergedPaths.add(tw.getPathString()); + } } return true; } |