git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: "Tor Arne Vestbø" <torarnv@gmail.com>
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, 3 Feb 2009 08:57:12 -0800	[thread overview]
Message-ID: <20090203165712.GW26880@spearce.org> (raw)
In-Reply-To: <20090203161539.GV26880@spearce.org>

"Shawn O. Pearce" <spearce@spearce.org> wrote:
> Tor Arne Vestbø <torarnv@gmail.com> wrote:
> > The occurance of a '/' as the next character in the longer path
> > does not neccecarily mean the two paths are equal, for example
> > when the longer path has more components following the '/'.
> > 
> > Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com>
> > ---
> >  .../jgit/treewalk/AbstractTreeIteratorTest.java    |   93 ++++++++++++++++++++
> >  .../jgit/treewalk/AbstractTreeIterator.java        |    4 +-
> >  2 files changed, 95 insertions(+), 2 deletions(-)
> >  create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/treewalk/AbstractTreeIteratorTest.java
> 
> *sigh*
> 
> I can't get Eclipse to run this test.  Every time I try it comes
> up with a CNFE:

@#*@!#@!!@*@ MAVEN ECLIPSE PLUGIN.

The Maven Eclipse plugin, which shouldn't have even been invoked
because JGit doesn't use Maven within Eclipse, was crashing and
causing the JDT to stop compiling.  No records was reported in
the Problems view, but my Error Log was full of JDT crashes due
to ClassCastExceptions.  Uninstalling the Maven plugin fixed the
build and made Eclipse come up with the same failures:

>   Failed tests:
>     testNoDF_NoGap(org.spearce.jgit.treewalk.NameConflictTreeWalkTest)
>     testDF_GapByOne(org.spearce.jgit.treewalk.NameConflictTreeWalkTest)
>     testDF_SkipsSeenSubtree(org.spearce.jgit.treewalk.NameConflictTreeWalkTest)
> 
>   Tests run: 773, Failures: 3, Errors: 0, Skipped: 0

So at least my workbench is now reporting the same as Maven on
the command line.  But elsewhere I use Maven (different workbench,
same Eclipse installation) so now I've just shot myself in the foot
and need to install a duplicate copy of Eclipse.  Whoopie.

</unrelated-to-your-patch>

I'm quite certain the breakage in testNoDF_NoGap on line 86 of
NameConflictTreeWalkTest is caused by your change.  Your code is
making "a.b" (a file) equal to "a/" (a tree).  That can't be right.

Going back through the code, the old version of pathCompare
still seems right to me.  And your test cases are somewhat
broken.  We shouldn't ever be looking at cases like this:

  assertTrue(new FakeTreeIterator("a", FileMode.TREE).pathCompare(
             new FakeTreeIterator("a/b", FileMode.REGULAR_FILE)) < 0);

There's no such thing as a tree entry with '/' in the name.  Really
this should have been:

  assertTrue(new FakeTreeIterator("a", FileMode.TREE).pathCompare(
             new FakeTreeIterator("a", FileMode.TREE)) < 0);

at which point they must be equal, because they are both a tree
named "a".  So that throws off a good chunk of your new test cases.
I don't know how I missed this yesterday when you showed me a version
of the tests, but I did.  We should never be doing a compare of
"a/b" in the pathCompare method.

-- 
Shawn.

      parent reply	other threads:[~2009-02-03 16:58 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ø
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   ` 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=20090203165712.GW26880@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --cc=torarnv@gmail.com \
    /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).