Browse Source

Merge "ObjectWalk: Fix reset for non-commit objects"

stable-0.11
Chris Aniszczyk 14 years ago committed by Code Review
parent
commit
c1de63262e
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java

11
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java

@ -45,6 +45,8 @@ package org.eclipse.jgit.revwalk;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jgit.JGitText; import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.errors.CorruptObjectException;
@ -85,6 +87,8 @@ public class ObjectWalk extends RevWalk {
private CanonicalTreeParser treeWalk; private CanonicalTreeParser treeWalk;
private List<RevObject> rootObjects;
private BlockObjQueue pendingObjects; private BlockObjQueue pendingObjects;
private RevTree currentTree; private RevTree currentTree;
@ -115,6 +119,7 @@ public class ObjectWalk extends RevWalk {
*/ */
public ObjectWalk(ObjectReader or) { public ObjectWalk(ObjectReader or) {
super(or); super(or);
rootObjects = new ArrayList<RevObject>();
pendingObjects = new BlockObjQueue(); pendingObjects = new BlockObjQueue();
treeWalk = new CanonicalTreeParser(); treeWalk = new CanonicalTreeParser();
} }
@ -425,6 +430,11 @@ public class ObjectWalk extends RevWalk {
@Override @Override
protected void reset(final int retainFlags) { protected void reset(final int retainFlags) {
super.reset(retainFlags); super.reset(retainFlags);
for (RevObject obj : rootObjects)
obj.flags &= ~IN_PENDING;
rootObjects = new ArrayList<RevObject>();
pendingObjects = new BlockObjQueue(); pendingObjects = new BlockObjQueue();
treeWalk = new CanonicalTreeParser(); treeWalk = new CanonicalTreeParser();
currentTree = null; currentTree = null;
@ -436,6 +446,7 @@ public class ObjectWalk extends RevWalk {
private void addObject(final RevObject o) { private void addObject(final RevObject o) {
if ((o.flags & IN_PENDING) == 0) { if ((o.flags & IN_PENDING) == 0) {
o.flags |= IN_PENDING; o.flags |= IN_PENDING;
rootObjects.add(o);
pendingObjects.add(o); pendingObjects.add(o);
} }
} }

Loading…
Cancel
Save