Repository navigation
lib/ignore: Only skip for toplevel includes (fixes #6487) - #6508
Conversation
calmh
left a comment
There was a problem hiding this comment.
So this looked sane to me, but causes a test failure on Windows. Potentially the slash stuff needs to account for the platform local separator? We accept \ as separator in the patterns on Windows, in addition to forward slash...
calmh
left a comment
There was a problem hiding this comment.
I'm still confused about this though. I suspect the tests pass because the if p.pattern[0] != '/' means we never apply the optimizations on Windows, but really we should apply the optimization for like
!\foo
*
no?
|
Though I guess that's the anti-issue of the one this solves |
|
Ignore patterns are slashes only, we don't accept backslashes there. Before matching we always use The test originally failed on windows because I used a path with slashes to compare to |
|
But that happens after we load and parse and decide whether to optimize? |
|
Yes, my link didn't point to the best place: The change in this PR acts on |
|
So it is! |
Purpose
The assumption when "optimizing" includes in #6151, that all rooted patterns without wildcards do not require scanning the entire tree is just not correct - at least not without additional smarts. We'd have to make sure that all the parent path components are also included. That's definitely doable, but not something I am interested in right now. So I just dumbed the logic down to just optimize includes in the root, nowhere else.
Testing
I needed to adjust the unit testing in lib/ignore, but the relevant test reproducing #6151 is in lib/scanner.