Open VladyslavSikailo opened 3 years ago
Have a look at: https://github.com/vaimo/composer-patches/issues/46#issuecomment-769016997 for a workaround
Encountered the issue trying to patch Magento/Bundle/etc/events.xml
The vendor file has CRLF line endings in my magento/project-enterprise-edition@2.4.0
with magento/module-bundle@101.0.0
My patch file is built with LF line endings as it also contains changes for PHP files of the Magento/Bundle module and they have LF line endings.
Proposed fix: add --ignore-whitespace
option to "PATCH" applier by default into "check" and "patch" operations.
Workaround: add this option to applier manually in your composer.json
"extra": {
"patcher": {
"appliers": {
"PATCH": {
"check": {
"default": "[[bin]] -t --verbose -p{{level}} --no-backup-if-mismatch --ignore-whitespace --dry-run < {{file}}"
},
"patch": {
"default": "[[bin]] -t -p{{level}} --no-backup-if-mismatch --ignore-whitespace < {{file}}"
}
}
}
},
UPDATE: as mentioned in other thread --ignore-whitespace
does not help.
I ended up with creating a separate patch built with CRLF for etc/events.xml
Patches cannot be applied for files with CRLF line terminators
Pre-requisites
To Reproduce Steps to reproduce the behavior:
Expected Patch should be installed
Actual
Notes Looks like it happens because when I added vendor/mageplaza/magento-2-seo-extension/Plugin/SeoRender.php into git indexation, file becomes from CRLF to LF line terminator (becuase I have done it on Mac, but it was developed on Windows). Git showed me following warning:
And patch contains LF line terminator. But when composer:install is executed, file again becomes to CRLF.