Skip to main content

walk

Function walk 

Source
pub fn walk(root: &Path, ignore: &[String]) -> Result<Vec<SourceFile>>
Expand description

Walk the tree under root, honoring .gitignore and the ignore globs, yielding one SourceFile per file, symlink, and directory. Paths are relative to root, sorted.

Hidden entries are not skipped: a dot-directory like .github/ is part of the graph. The lone exception is VCS metadata ([VCS_DIRS]), pruned from traversal — .git/ would otherwise flood the graph with internal state.

Only committed .gitignore rules prune the walk. The user’s global gitignore, the per-clone .git/info/exclude, and ignore files above root are all ignored, so the graph depends only on what is committed at the root.

The walk does not follow symlinks: a symlink is a leaf node at its own path, never traversed through. Its relationship to its target is carried by the edge the builder emits, not by re-walking the target. So a symlink to a directory does not duplicate that directory’s subtree, and a symlink to a path outside the root never pulls outside content into the graph.

Only files carry bytes (and therefore a hash). Symlinks and directories are untrackable: they resolve link targets but are never hashed or locked.