-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Finder] Adjust regex to correctly match comments in gitignore contents #33340
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
Ready to merge or is more review needed? |
[ | ||
' | ||
/app/cache/ | ||
\#EscapedComment |
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 about using a real file name to check that it will be in the list (#file.txt
like in a test above)?
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.
That'd indeed be more useful, I'll change it.
33b2695
to
e56fc7c
Compare
Thank you @Jeroeny. |
…nore contents (Jeroeny) This PR was squashed before being merged into the 4.3 branch (closes #33340). Discussion ---------- [Finder] Adjust regex to correctly match comments in gitignore contents | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32985 | License | MIT Description from issue: When using `ignoreVCSIgnored` as argument with the Symfony Finder, it will construct a regex equivalent of the gitignore pattern. However it seems that when a comment line (prefixed with `#`) is present in the `.gitignore`, the regex used to remove comment lines matches every line and thus returns `$gitignoreFileContent` as empty. Commits ------- e56fc7c [Finder] Adjust regex to correctly match comments in gitignore contents
Description from issue:
When using
ignoreVCSIgnored
as argument with the Symfony Finder, it will construct a regex equivalent of the gitignore pattern. However it seems that when a comment line (prefixed with#
) is present in the.gitignore
, the regex used to remove comment lines matches every line and thus returns$gitignoreFileContent
as empty.