Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
andrew
left a comment
There was a problem hiding this comment.
Thanks for picking up #204. Root .gitignore rules, pruning, and tracked files inside an ignored directory all work when I run this against a scratch repo. A few things need to change before it goes in.
Rules above the scan root are never loaded. loadIgnoreRules only reads .gitignore files in directories the walk visits, so with /sub/data/ in the repository root's .gitignore, brief ./sub still counts everything under sub/data/. In my test that put Ruby first from five ignored .rb files against one tracked .go file. When the root is inside a work tree, find the top of the work tree and load each ancestor .gitignore, scoped to its own directory, before the walk starts. Please add a test that scans a subdirectory.
.git/info/exclude is not read, because the matcher is built with gitignore.New(""). A directory listed only there shows as ignored in git status but still supplies language evidence. Load .git/info/exclude for each analysis root on real directories. Leave the global core.excludesFile out so the report does not vary by machine, and say so in the README sentence.
The README says each included submodule uses its own rules, but no test covers a submodule. The non-git on-disk path is also untested: the git test always runs inside a repository and the other one uses fstest.MapFS. One test for each, please.
In detect/ignores_test.go, the language check packs four conditions into one expression, including hasLanguage("Python") == trackedOnly. Split it into one assertion per language so a failure names the language that was wrong.
Closes #204.
Load project and nested .gitignore rules as the bounded project walk visits each directory. Prune ignored untracked subtrees and apply the same visibility to direct tool, script, and manifest probes. Tracked paths keep contributing even when they match a rule, and ordinary untracked source remains visible. Included submodules use their own rule scopes. Project resources drawn from the file index follow the same visibility rules.
Two regressions failed on the original implementation and pass here. A temporary Git repository exercises tracked files inside an ignored directory, ordinary new source, and ignored tool and manifest files. An in-memory tree verifies nested negation and that a pruned subtree does not consume its children's scan budget. The full detect package suite and go vet passed on Windows with Go 1.27.3.
Summary by CodeRabbit
.gitignorerules in the project root and visited directories, excluding ignored untracked paths while keeping tracked files and non-ignored new files available.