Repository navigation
Conversation
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This PR modifies the _is_ignored logic in graphify/detect.py so that when matching a gitignore pattern from a parent anchor against a target in absolute (non-path_relative) mode, it recomputes the relative path against the scan root rather than the pattern's anchor in cases where the root is deeper than the anchor. The intent, per the referenced issue #2468, is to prevent a parent .gitignore that ignores the scan root directory itself from causing files inside that scan root to be excluded, while still honoring unrelated parent ignore patterns. Two new tests are added to tests/test_detect.py covering the scan-root-ignored case and the case where an unrelated node_modules/ rule from the parent should still apply.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 1252 functions depend on the 435 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
detect()— 84 callers, 11 callees
Verification — 1252 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 668 function(s) in the blast radius were not formally verified this run
· 1 more finding(s) on lines outside this diff (see the check run).
follow-up) The #2475 fix recomputed the match path against the explicit scan root but skipped the _nfc() normalization rel_anchor gets, so an NFD-named path could miss a parent ignore pattern under the #2544 NFC-matching regime. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Shipped in v0.9.41 ( |
Summary
Fixes Issue #2468 by preventing unanchored parent
.gitignorepatterns from incorrectly matching the scan root itself when the user explicitly scans a subdirectory of a Git repository.Previously, when a parent
.gitignorecontained an unanchored directory rule matching the scan root (for example,graphify-corpus/), Graphify evaluated the path relative to the parent ignore anchor. This allowed the scan root's own directory name to participate in unanchored basename matching, causing descendant directories to be incorrectly pruned during traversal.The fix preserves existing ignore semantics while ensuring that unanchored parent patterns are evaluated relative to the scan root in this specific scenario, preventing the scan root itself from becoming a match candidate.
Changes
Adjust unanchored parent ignore matching in
_is_ignored()to evaluate scan-root descendants using scan-root-relative paths when appropriate.Preserve existing behavior for:
.gitignorefilesTests
Added regression tests covering:
.gitignorerule no longer suppresses traversal of the explicitly requested scan root..gitignorerules continue to ignore unrelated directories (for example,node_modules/) inside the scan root, ensuring existing ignore semantics are preserved.Validation
graphify/detect.py.