Always initialize TreeWalk with a single empty tree
commitf0ef5e1ef09d346432fead17bc82d78b7cfbd621
authorShawn O. Pearce <spearce@spearce.org>
Thu, 15 May 2008 01:16:07 +0000 (14 21:16 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 17 May 2008 03:59:49 +0000 (16 23:59 -0400)
tree81156923a2b34384720d21df431f99a00695f5d3
parent44c411f6c4fb62e4926ddc8dd2e6ad56278d44dd
Always initialize TreeWalk with a single empty tree

By loading a single empty tree iterator into the tree walk's
initial list of trees we can avoid array index out of bound
exceptions if the application tries to call next() prior to
actually giving us a tree to iterate.  This can simplify a
few application cases where we may need to advance an open
tree walk, or load a new tree into one if we are already at
the end and have no more entries.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java