Repository navigation
Resolve excluded ancestor directories before descendant negations - #154
Closed
sricharanreddycheruku wants to merge 1 commit into
Closed
sricharanreddycheruku wants to merge 1 commit into
sricharanreddycheruku wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A negated descendant pattern can currently re-include a file whose parent is still
excluded. For example, ["dir/", "!dir//file"] incorrectly permits
"dir/nested/file" in all three backends. Git keeps it ignored because dir/nested/
is excluded. Likewise, ["/", "!src/"] should permit src/a.txt while keeping
src/nested/file ignored; re-including src/ does not reopen every nested directory.
The simple backend also disagrees with RE2/Hyperscan for ["", "!**/a.py"].
Resolve strict ancestors from outermost to innermost before matching the requested
path. Return the index of the first blocking rule, and skip repeated ancestor
checks during these individual directory queries. Keep reopened directories usable
and require each still-excluded parent to be re-included independently.
This extends the ancestor-resolution work from #129/#137/#144; the earlier merged
changes leave these cases reproducible. No duplicate open PR was found.
Validation:
file/directory queries, rule indices and explicitly reopened ancestors. Against
original source they report 68 failures, including subtests.
passed on each, with all three matching backends installed.
Update the README with the parent-exclusion rule and change history.
Performance: checking every strict ancestor adds work for unignored nested paths.
A small four-pattern, 2,000-query microbenchmark measured roughly 4/17/62 µs per
query at depths 1/5/12 with the simple backend, 5/19/48 µs with RE2 and 1.5/8/20 µs
with Hyperscan. The original implementation took approximately 1–4 µs in these
cases. These are workspace measurements under concurrent build load, not a general
throughput estimate. Ancestor queries avoid recursive rechecking and stop at the
first excluded directory.