From: "Tomi Pakarinen" <tomi.pakarinen@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: "Robin Rosenberg" <robin.rosenberg@dewire.com>, git@vger.kernel.org
Subject: Re: [JGIT PATCH 8/8] Define a basic merge API, and a two-way tree merge strategy
Date: Sat, 17 Jan 2009 21:16:21 +0200 [thread overview]
Message-ID: <f299b4f30901171116y216835c9jc11df2d424ee0377@mail.gmail.com> (raw)
In-Reply-To: <20090115210936.GI10179@spearce.org>
testTrivialTwoWay_disjointhistories() failed because merge strategy
didn't handle missing base
version. Am'i right?
Tomi.
>From 1ed694b55d307c640d29eeebfcd108e08681297b Mon Sep 17 00:00:00 2001
From: Tomi Pakarinen <tomi.pakarinen@iki.fi>
Date: Sat, 17 Jan 2009 20:56:04 +0200
Subject: [PATCH] If base version missing, we can merge version from
one of other trees.
Signed-off-by: Tomi Pakarinen <tomi.pakarinen@iki.fi>
---
.../jgit/merge/StrategySimpleTwoWayInCore.java | 28 +++++++++++++++-----
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
index 893add9..eb718ab 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
@@ -43,6 +43,7 @@
import org.spearce.jgit.dircache.DirCacheBuilder;
import org.spearce.jgit.dircache.DirCacheEntry;
import org.spearce.jgit.errors.UnmergedPathException;
+import org.spearce.jgit.lib.FileMode;
import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.treewalk.AbstractTreeIterator;
@@ -119,13 +120,26 @@ protected boolean mergeImpl() throws IOException {
}
final int modeB = tw.getRawMode(T_BASE);
- if (modeB == modeO && tw.idEqual(T_BASE, T_OURS))
- add(T_THEIRS, DirCacheEntry.STAGE_0);
- else if (modeB == modeT && tw.idEqual(T_BASE, T_THEIRS))
- add(T_OURS, DirCacheEntry.STAGE_0);
- else {
- conflict();
- hasConflict = true;
+ if (!FileMode.MISSING.equals(modeB)) {
+ if (modeB == modeO && tw.idEqual(T_BASE, T_OURS))
+ add(T_THEIRS, DirCacheEntry.STAGE_0);
+ else if (modeB == modeT && tw.idEqual(T_BASE, T_THEIRS))
+ add(T_OURS, DirCacheEntry.STAGE_0);
+ else {
+ conflict();
+ hasConflict = true;
+ }
+ } else {
+ if (!FileMode.MISSING.equals(modeO)
+ && FileMode.MISSING.equals(modeT))
+ add(T_OURS, DirCacheEntry.STAGE_0);
+ else if (FileMode.MISSING.equals(modeO)
+ && !FileMode.MISSING.equals(modeT))
+ add(T_THEIRS, DirCacheEntry.STAGE_0);
+ else {
+ conflict();
+ hasConflict = true;
+ }
}
}
builder.finish();
--
1.6.0.4
next prev parent reply other threads:[~2009-01-17 19:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-13 21:10 [JGIT PATCH 0/8] Crude merge support Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 1/8] Expose the raw path for the current entry of a TreeWalk Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 2/8] Expose DirCacheEntry.getFileMode as a utility function Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 3/8] Add writeTree support to DirCache Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 4/8] Allow a DirCache to be created with no backing store file Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 5/8] Allow CanonicalTreeParsers to be created with a UTF-8 path prefix Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 6/8] Recursively load an entire tree into a DirCacheBuilder Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 7/8] Allow DirCacheEntry instances to be created with stage > 0 Shawn O. Pearce
2008-10-13 21:10 ` [JGIT PATCH 8/8] Define a basic merge API, and a two-way tree merge strategy Shawn O. Pearce
2008-10-23 21:14 ` Robin Rosenberg
2009-01-15 21:05 ` Robin Rosenberg
2009-01-15 21:09 ` Shawn O. Pearce
2009-01-17 19:16 ` Tomi Pakarinen [this message]
2009-01-18 20:21 ` Robin Rosenberg
2009-01-19 17:42 ` Shawn O. Pearce
2009-01-19 17:51 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f299b4f30901171116y216835c9jc11df2d424ee0377@mail.gmail.com \
--to=tomi.pakarinen@gmail.com \
--cc=git@vger.kernel.org \
--cc=robin.rosenberg@dewire.com \
--cc=spearce@spearce.org \
--cc=tomi.pakarinen@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).