-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Ticket 4911 - Fixed ignoreDotFiles(true) which did not exclude folders properly #4932
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
Conversation
{ | ||
$this->patterns = array(); | ||
foreach ($directories as $directory) { | ||
$this->patterns[] = '#(^|/)'.preg_quote($directory, '#').'(/|$)#'; | ||
} | ||
|
||
if (!is_null($extraPatterns)) { |
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.
this should be null !==
. And it would probably be even better to make the argument default to an empty array and remove this check entirely
@nathanlon FYI, the email address used by your git commits does not seem to be associated to your github account. So these commits will not be linked to you in the contributors page of the symfony.com website until you fix it. |
Ticket 4911 - Found that ExcludeDirectoryFilterIterator.php would not take .*, but only specific folder full names, so added $extraPatterns and extended tests to look at a /.foo/bar (was missed as the .bar in /.foo/.bar was hiding the excluding the folder with the correctly excluded file.
Thanks @stof , I have removed the is_null check and made the default an array as suggested. I've also edited the committer to align with my github account. I can't get in to sensiolabs connect today though as password resets don't work. |
I don't like the implementation as it feels like a hack. #4739 is probably a better option to fix the issue. |
{ | ||
$this->patterns = array(); | ||
foreach ($directories as $directory) { | ||
$this->patterns[] = '#(^|/)'.preg_quote($directory, '#').'(/|$)#'; | ||
} | ||
|
||
foreach ($extraPatterns as $pattern) { |
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.
you could use array_merge
here. extraPatterns
could also be patterns
. Otherwise this PR looks good to me.
Closing this PR in favor of #5128 |
[Finder] Issue #4911 - Fixed ignoreDotFiles(true) which did not exclude folders properly
Found that ExcludeDirectoryFilterIterator.php would not take .*, but only specific folder full names, so added $extraPatterns and extended tests to look at a /.foo/bar (was missed as the .bar in /.foo/.bar was hiding the excluding the folder with the correctly excluded file.
Bug fix: yes
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass:
Fixes the following tickets: #4911
License of the code: MIT