git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [JGIT PATCH 8/8] Define a basic merge API, and a two-way tree merge strategy
Date: Thu, 23 Oct 2008 23:14:29 +0200	[thread overview]
Message-ID: <200810232314.29867.robin.rosenberg@dewire.com> (raw)
In-Reply-To: <1223932217-4771-9-git-send-email-spearce@spearce.org>

Hi, Shawn

Shouldn't testTrivialTwoWay_disjointhistories()  work?

The two trees have nothing in common and so should be trivially mergeable.

-- robin

>From cef2695431e368da616a1e9c8de3e5e419854a4c Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <robin.rosenberg@dewire.com>
Date: Thu, 23 Oct 2008 23:09:10 +0200
Subject: [EGIT PATCH] Simple merge test

---
 .../org/spearce/jgit/merge/SimpleMergeTest.java    |   28 ++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java
new file mode 100644
index 0000000..8ec1c7f
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/merge/SimpleMergeTest.java
@@ -0,0 +1,28 @@
+package org.spearce.jgit.merge;
+
+import java.io.IOException;
+
+import org.spearce.jgit.lib.ObjectId;
+import org.spearce.jgit.lib.RepositoryTestCase;
+
+public class SimpleMergeTest extends RepositoryTestCase {
+
+	public void testTrivialTwoWay_noway() throws IOException {
+		Merger ourMerger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
+		boolean merge = ourMerger.merge(new ObjectId[] { db.resolve("a"), db.resolve("c") });
+		assertFalse(merge);
+	}
+
+	public void testTrivialTwoWay_disjointhistories() throws IOException {
+		Merger ourMerger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
+		boolean merge = ourMerger.merge(new ObjectId[] { db.resolve("a"), db.resolve("c~4") });
+		assertTrue(merge); 
+	}
+
+	public void testTrivialTwoWay_ok() throws IOException {
+		Merger ourMerger = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
+		boolean merge = ourMerger.merge(new ObjectId[] { db.resolve("a^0^0^0"), db.resolve("a^0^0^1") });
+		assertTrue(merge);
+		assertEquals(db.mapTree("a^0^0").getId(), ourMerger.getResultTreeId());
+	}
+}
-- 
1.6.0.2.308.gef4a

  reply	other threads:[~2008-10-23 21:15 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 [this message]
2009-01-15 21:05                   ` Robin Rosenberg
2009-01-15 21:09                     ` Shawn O. Pearce
2009-01-17 19:16                       ` Tomi Pakarinen
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=200810232314.29867.robin.rosenberg@dewire.com \
    --to=robin.rosenberg@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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).