Skip to content

feat: add --gitignore flag to skip files matched by .gitignore patterns#453

Merged
kehoecj merged 1 commit into
mainfrom
feat/support-ignore
Apr 24, 2026
Merged

feat: add --gitignore flag to skip files matched by .gitignore patterns#453
kehoecj merged 1 commit into
mainfrom
feat/support-ignore

Conversation

@kehoecj
Copy link
Copy Markdown
Collaborator

@kehoecj kehoecj commented Apr 24, 2026

Closes #452

Added a --gitignore flag that skips files and directories matched by git's ignore rules during file discovery removing the need to add gitignore patterns in --exclude-dirs or .cfv.toml.

The flag respects the full git ignore chain:

  • .gitignore files (including nested ones in subdirectories)
  • .git/info/exclude
  • Global git ignore config (core.excludesFile)

@kehoecj kehoecj marked this pull request as ready for review April 24, 2026 15:32
@kehoecj kehoecj requested a review from a team as a code owner April 24, 2026 15:32
@kehoecj kehoecj force-pushed the feat/support-ignore branch from 98f8817 to 040ccb2 Compare April 24, 2026 15:34
Uses go-git's gitignore parser with lazy loading during WalkDir to avoid
double tree traversal. Supports nested .gitignore files, .git/info/exclude,
and global git ignore config.

Available via CLI flag, CFV_GITIGNORE env var, and gitignore=true in .cfv.toml.
Replaces the earlier --respect-gitignore prototype and swaps sabhiram/go-gitignore
for go-git/go-git/v5 plumbing/format/gitignore.
@Montana
Copy link
Copy Markdown

Montana commented Apr 24, 2026

@kehoecj This looks great, and again thank you so much.

@kehoecj kehoecj merged commit 38d4e3d into main Apr 24, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for honoring .gitignore / .ignore patterns during filesystem discovery

2 participants