git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 3, 2009, 17:03 UTC
Message-ID
<20090203170337.GX26880@spearce.org>
In-Reply-To
<49887274.8040601@gmail.com>
Tor Arne Vestbø <torarnv@gmail.com> wrote:
Show 8 quoted lines
> 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.
Previous: Tor Arne VestbøNext: Tor Arne Vestbø
Message 4 of 7 in “Fix AbstractTreeIterator path comparion betwen 'a' and 'a/b'”
  1. Fix AbstractTreeIterator path comparion betwen 'a' and 'a/b'Tor Arne Vestbø, Feb 2, 2009
  2. Shawn O. PearceFeb 3, 2009
  3. Tor Arne VestbøFeb 3, 2009
  4. Shawn O. PearceFeb 3, 2009
  5. Tor Arne VestbøFeb 3, 2009
  6. Add a few test cases for AbstractTreeIterator's pathCompareTor Arne Vestbø, Feb 3, 2009
  7. Shawn O. PearceFeb 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.