Fix TreeWalk to correctly handle missing subtrees
commita503e91200dd21a0992a60dd4b1af3c25f1855bd
authorShawn O. Pearce <spearce@spearce.org>
Wed, 13 Aug 2008 21:42:22 +0000 (13 14:42 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Thu, 14 Aug 2008 17:36:49 +0000 (14 19:36 +0200)
tree4db8d3ba32ce9114ac7c2e06f755bd527a4e00cf
parent0a40115e4e052044251c8a50a356ef3d8c000475
Fix TreeWalk to correctly handle missing subtrees

When we are walking through a pair of trees and one of the two trees has
added a new subtree in the middle we need to make sure we use the special
EmptyTreeIterator as a placeholder for the other tree which is missing
that path entry.

This fixes the issue Robin noticed where pulling up the difference for
"55e9a699df...5b07a80cf org.spearce.jgit.test" showed files deleted
by 5b07 when they were not even touched.  The addition of a new subtree
("revwalk") by 5b07 is what threw the iteration off, causing the other
tree (55e9's) to enter into the wrong subtree at the wrong time.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/treewalk/TreeWalkBasicDiffTest.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java