New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include excluded files #2593
Include excluded files #2593
Conversation
ad66886
to
be82766
Compare
5996291
to
abff473
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, left a couple of minor comments 👍
if($compare !== 0) { | ||
return $compare; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a commenta about what this is doing? i.e. if the segments are the same length then...
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly should I comment here. If they are the same then their order doesn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explaining what the different branches mean. It's not obvious what ==='**
and ==='*'
mean and why we return. what happens with baz*
or *baz
or with */baz/**/boo*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah wildcards within a path aren't handled. That's a valid point.
$partsB = explode(DIRECTORY_SEPARATOR, $b); | ||
$countDiff = count($partsA) <=> count($partsB); | ||
if ($countDiff !== 0) { | ||
// Longer paths should come first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paths with more segments.
Fixes #2485
The include and exclude logic now allows for included paths inside excluded paths.
Also the tests for the file provider now also check that it returns the correct files and not just the count.
How this worked before
Call
includes
to filter the list of files to include and then callexclude
to remove files from that list that are excluded.How it works now
Build a map of paths and if they are included or not and tries to match all files against that map to see if they should be included or not.