我想利用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')}"
答案 0 :(得分:-1)
通过从源代码安装软件包并调用git diff > /path/to/project/patch.diff
即可。
但是原始问题仍然有效-我可以使用带有composer-patches的常规diff文件吗?
从源代码安装软件包:
composer require --prefer-source vendor/package
如果您已经安装了dist-package,只需使用--prefer-source参数再次运行命令。