git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: tomi.pakarinen@iki.fi
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: Mon, 19 Jan 2009 09:51:54 -0800	[thread overview]
Message-ID: <20090119175154.GD14053@spearce.org> (raw)
In-Reply-To: <20090119174254.GC14053@spearce.org>

"Shawn O. Pearce" <spearce@spearce.org> wrote:
> Tomi Pakarinen <tomi.pakarinen@gmail.com> wrote:
> > testTrivialTwoWay_disjointhistories() failed because merge strategy
> > didn't handle missing base
> > version. Am'i right?
> 
> If that isn't coming out right then perhaps tw.idEqual() is busted

Yup, that's what it is, idEqual is busted.

The definition of TreeWalk.idEqual is:

	public boolean idEqual(final int nthA, final int nthB) {
		final AbstractTreeIterator ch = currentHead;
		final AbstractTreeIterator a = trees[nthA];
		final AbstractTreeIterator b = trees[nthB];
		return a.matches == ch && b.matches == ch && a.idEqual(b);
	}

The problem is this method always returns false if the name isn't
defined in either path.  I think this is the definition we want
instead:

		if (a.matches == ch && b.matches == ch)
			return a.idEqual(b);
		if (a.matches != ch && b.matches != ch) {
			// If neither tree matches the current path node then neither
			// tree has this entry. In such case the ObjectId is zero(),
			// and zero() is always equal to zero().
			//
			return true;
		}
		return false;

Patch to follow.

-- 
Shawn.

      reply	other threads:[~2009-01-19 17:53 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
2009-01-18 20:21                         ` Robin Rosenberg
2009-01-19 17:42                         ` Shawn O. Pearce
2009-01-19 17:51                           ` Shawn O. Pearce [this message]

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=20090119175154.GD14053@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --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).