walk
Traverse the entries in a tree and its subtrees in post or pre-order.
Signature
ts
class Tree {
walk(mode: TreeWalkMode, callback: (entry: TreeEntry) => number): void;
}
Parameters
- moderequired · TreeWalkMode
A indicator of whether a tree walk should be performed in pre-order or post-order.
-
PreOrder
: Runs the traversal in pre-order.
-PostOrder
: Runs the traversal in post-order. - callbackrequired · (entry: TreeEntry) => number
The callback function will be run on each node of the tree that's walked. The return code of this function will determine how the walk continues.
libgit2
requires that the callback be an integer, where 0 indicates a successful visit, 1 skips the node, and -1 aborts the traversal completely.