Skip to content

script-utils/git

Git-derived file listings for the repo-walking scripts.

Tooling that walks the repository must skip whatever .gitignore skips — otherwise every script grows its own hand-maintained ignore list, the lists drift apart, and a path that is gitignored but not enumerated (a nested node_modules under a test fixture, say) is walked anyway. Most tools have a native switch for this; the ones that do not take a file list instead, and that is what this module produces.

Asking git rather than parsing .gitignore is deliberate: it honors nested ignore files, ! negations, .git/info/exclude, and the user’s global excludes, at no cost to us.

InterfaceDescription
GetNonIgnoredFilesOptionsOptions for getNonIgnoredFiles.
FunctionDescription
getNonIgnoredFilesLists the repository files that .gitignore does not exclude. Covers both tracked files and untracked-but-not-ignored ones, so a brand-new file is checked before it is ever committed.