From 0d94a5ca666abbc787392565bbeb96c47dd36e7e Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" <spearce@spearce.org> Date: Tue, 2 Feb 2010 11:39:24 -0800 Subject: [PATCH] Ensure the tree parser resets in ObjectWalk During dispose() or reset() we are suppose to be restoring the ObjectWalk instance back to the original pre-walk state, but we failed to reset the tree parser. This can lead to confusing state if the ObjectWalk was reused by the caller, as entries from the old walk might be reported as part of the new walk. Change-Id: I6237bae7bfd3794e8b9a92b4dd475559cc72e634 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index 690458593..b3acf518c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -371,6 +371,7 @@ public String getPathString() { public void dispose() { super.dispose(); pendingObjects = new BlockObjQueue(); + treeWalk = new CanonicalTreeParser(); nextSubtree = null; currentTree = null; } @@ -379,6 +380,7 @@ public void dispose() { protected void reset(final int retainFlags) { super.reset(retainFlags); pendingObjects = new BlockObjQueue(); + treeWalk = new CanonicalTreeParser(); nextSubtree = null; } -- GitLab