Subject: Re: [JGIT PATCH] Fix AbstractTreeIterator path comparion betwen 'a' and 'a/b'

From: "Shawn O. Pearce" <[email-masked]>
Date: Tue, 3 Feb 2009 09:03:37 -0800

Tor Arne Vestbø <[email-masked]> wrote:
> Shawn O. Pearce wrote:
> > Aside from this test not running, Eclipse says the tests pass.  But
> > Maven tells another story: Tests run: 773, Failures: 3, Errors: 0
> 
> Strange :/
> 
> Nevertheless, there shouldn't be any failures, I see all three of them
> when running in Eclipse, so I messed up, sorry for that. Will fix ASAP.

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);
+	}
----

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.

-- 
Shawn.