如何解决如何格式化diff / patch文件以将其与cweagans / composer-patches一起应用
我想利用cweagans / composer-patches将补丁应用于第三者软件包。
所以我修复了一个错误,并使用diff导出了补丁
cd path/to/package
diff -u fileA fileB > /path/to/project/patch.diff
并添加到composer.json:
{
"patches": {
"vendor/packagekey": {
"Bug description": "patch.diff"
}
}
}
在执行作曲家安装时我得到了
Could not apply patch! Skipping. The error was: Cannot apply patch
我是否必须从源代码安装软件包并使用git diff格式化补丁?
如果我需要从源代码安装软件包-如何告诉作曲家仅从源代码安装该软件包?我不想从源代码安装所有软件包...
更新: 那就是补丁文件的样子
--- Resources/Private/Templates/ImageManipulation/ImageManipulationElement.html 2020-08-12 13:37:40.759056419 +0200
+++ Resources/Private/Templates/ImageManipulation/ImageManipulationElement.html2 2020-08-12 13:37:28.694963559 +0200
@@ -19,7 +19,7 @@
data-severity="notice"
data-modal-title="{f:render(partial: 'ModalTitle',section:'Main',arguments: _all)}"
data-image-uid="{image.uid}"
- data-crop-variants="{config.cropVariants -> f:format.json()}'"
+ data-crop-variants='{config.cropVariants -> f:format.json()}'
data-button-preview-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.preview')}"
data-button-dismiss-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.cancel')}"
data-button-save-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.accept')}"
解决方法
通过从源代码安装软件包并调用git diff > /path/to/project/patch.diff
即可。
但是原始问题仍然有效-我可以使用带有composer-patches的常规diff文件吗?
从源代码安装软件包:
composer require --prefer-source vendor/package
如果您已经安装了dist-package,只需使用--prefer-source参数再次运行命令。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。