Skip to content

Add -tracked flag to ignore git-untracked files#70

Merged
andrew merged 1 commit into
mainfrom
tracked-only-scan
May 7, 2026
Merged

Add -tracked flag to ignore git-untracked files#70
andrew merged 1 commit into
mainfrom
tracked-only-scan

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 6, 2026

Closes #57.

Long-lived worktrees accumulate stray files that aren't part of the project: a package.json from a one-off experiment, htmlcov/ from a coverage run, build artifacts that aren't gitignored. These currently confuse detection and report languages and package managers that have nothing to do with the actual project.

The new -tracked flag restricts scanning to files that git ls-files reports. It runs once at engine start, builds a set of tracked paths and their parent directories, and filters every file existence check and directory walk through it. Untracked subtrees are skipped entirely via SkipDir so there's no cost to having a large htmlcov/ or similar lying around.

Using -tracked outside a git repository is an error.

Before, with an untracked package-lock.json and htmlcov/*.js in this repo:

Language:        Go (also: JavaScript)

After, with -tracked:

Language:        Go

@andrew andrew force-pushed the tracked-only-scan branch 2 times, most recently from f35c1fb to ee280e9 Compare May 7, 2026 18:23
@andrew andrew force-pushed the tracked-only-scan branch from ee280e9 to 150529a Compare May 7, 2026 18:27
@andrew andrew merged commit 2f0334b into main May 7, 2026
8 checks passed
@andrew andrew deleted the tracked-only-scan branch May 7, 2026 18:30
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 option to ignore untracked files when detecting in VCS context

1 participant