Skip to main content

parse_gitignore

Function parse_gitignore 

Source
pub fn parse_gitignore(root: &Path) -> Vec<String>
Expand description

Parse .gitignore from root and return a list of simple directory/file names to exclude during traversal.

Strategy (matches the TS parseGitignore in sync-turbo-env.ts):

  • Read .gitignore, split into lines
  • Strip comments (#) and blank lines
  • Normalize: remove leading / and trailing /
  • Drop negations (!) and wildcard patterns (*) — too complex for simple component-based matching; these are already handled by git itself
  • Always include .git and node_modules as safety nets