]> source.dussan.org Git - jgit.git/commit
Fix TreeWalk bug comparing DirCache and WorkingTree with ANY_DIFF 90/1490/2
authorShawn O. Pearce <spearce@spearce.org>
Wed, 1 Sep 2010 19:31:37 +0000 (12:31 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Thu, 2 Sep 2010 18:38:39 +0000 (11:38 -0700)
commit6f00a3e651e91592e2eb4f239b243a0aa2fe4610
tree7dc9f848bf103e6e8f6f8e3e2122b57bcbe0846f
parent244b1580b5155099bfdf98692d76c1b2a6183126
Fix TreeWalk bug comparing DirCache and WorkingTree with ANY_DIFF

When comparing a DirCache and a WorkingTree using ANY_DIFF we
sometimes didn't recursive into a subtree of both sides gave us
zeroId() back for the identity of a subtree.  This happens when the
DirCache doesn't have a valid cache tree for the subtree, as then
it uses zeroId() for the ObjectId of the subtree, which then appears
to be equal to the zeroId() of the WorkingTreeIterator's subtree.

We work around this by adding a hasId() method that returns true
only if this iterator has a valid ObjectId.  The idEquals method
on TreeWalk than only performs a compare between two iterators if
both iterators have a valid id.

Change-Id: I695f7fafbeb452e8c0703a05c02921fae0822d3f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/EmptyTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java