All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tor Arne Vestbø" <torarnv@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: Re: [JGIT PATCH] Fix AbstractTreeIterator path comparion betwen 'a' and 'a/b'
Date: Tue, 03 Feb 2009 18:10:30 +0100	[thread overview]
Message-ID: <49887A86.2040602@gmail.com> (raw)
In-Reply-To: <20090203170337.GX26880@spearce.org>

Shawn O. Pearce wrote:
> OK, so I think this is a valid test case, and as it turns out,
> it passes with the library unmodified:
> 
> --8<--
> +	public void testPathCompare() throws Exception {
> +		assertTrue(new FakeTreeIterator("a", FileMode.TREE).pathCompare(
> +				new FakeTreeIterator("a", FileMode.TREE)) == 0);
> +
> +		assertTrue(new FakeTreeIterator("a", FileMode.REGULAR_FILE).pathCompare(
> +				new FakeTreeIterator("a", FileMode.REGULAR_FILE)) == 0);
> +
> +		assertTrue(new FakeTreeIterator("a", FileMode.REGULAR_FILE).pathCompare(
> +				new FakeTreeIterator("a", FileMode.TREE)) < 0);
> +
> +		assertTrue(new FakeTreeIterator("a", FileMode.TREE).pathCompare(
> +				new FakeTreeIterator("a", FileMode.REGULAR_FILE)) > 0);
> +	}
> ----

Okey, I'll post a new patch with just those test cases, no changes to
the pathCompare, so we at least have those tests.

> Which means whatever problem you have been seeing in the decorator
> code is different than what we were originally thinking.  Perhaps you
> are trying to use the tree iterator APIs in a way that they aren't
> meant to be used (like passing in full paths where only a path name
> component is expected?), or there is something else lurking that
> we don't understand.


Ahh, I see. My patch was based on the assumption that 'a/b' was a valid
comparison, since I was seeing similar comparisons in live code. But as
you say, that's probably due to how I use the iterators. I will go back
and investigate how I ended up with 'a/b' paths in the first place.

Thanks :)

Tor Arne

  reply	other threads:[~2009-02-03 17:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 20:13 [JGIT PATCH] Fix AbstractTreeIterator path comparion betwen 'a' and 'a/b' Tor Arne Vestbø
2009-02-03 16:15 ` Shawn O. Pearce
2009-02-03 16:36   ` Tor Arne Vestbø
2009-02-03 17:03     ` Shawn O. Pearce
2009-02-03 17:10       ` Tor Arne Vestbø [this message]
2009-02-03 17:20         ` [JGIT PATCH v2] Add a few test cases for AbstractTreeIterator's pathCompare Tor Arne Vestbø
2009-02-03 16:57   ` [JGIT PATCH] Fix AbstractTreeIterator path comparion betwen 'a' and 'a/b' 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=49887A86.2040602@gmail.com \
    --to=torarnv@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.