Github user krlohnes commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/715#discussion_r169194905
--- Diff:
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
---
@@ -271,7 +274,17 @@ public RepeatEndStep(final Traversal.Admin traversal) {
protected Iterator<Traverser.Admin<S>> standardAlgorithm() throws
NoSuchElementException {
final RepeatStep<S> repeatStep = (RepeatStep<S>)
this.getTraversal().getParent();
while (true) {
- final Traverser.Admin<S> start = this.starts.next();
+ final Traverser.Admin<S> start;
+ if (this.starts.hasNext()) {
+ start = this.starts.next();
+ } else {
+ start = this.stashedStarts.pop();
+ }
+ // to make this step depth first search (DFS), we're
stashing the remainder for later
+ while (this.starts.hasNext()) {
+ stashedStarts.add(this.starts.next());
--- End diff --
I think this should be `push` rather than `add` so you maintain a
consistent `stack` behavior for a DFS.
---