【发布时间】:2020-08-12 12:31:29
【问题描述】:
我想利用 cweagans/composer-patches 将补丁应用到 3rd 方包。
所以我修复了一个错误并使用 diff 导出了补丁
cd path/to/package
diff -u fileA fileB > /path/to/project/patch.diff
并添加到composer.json:
{
"patches": {
"vendor/packagekey": {
"Bug description": "patch.diff"
}
}
}
当执行 composer install 我得到
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')}"
【问题讨论】:
-
你检查过补丁吗?也许你构建的方式错误(显示你的版本和原始代码之间的差异,这样你的更改被表示为“删除的行”而原始部分被表示为“添加的代码”)
-
@NicoHaase 我添加了补丁文件。
-
“我不想从源代码安装所有软件包”是什么意思?大多数 PHP 包都是通过它们的源安装的,只有一些提供了 PHAR,但是使用 Composer 安装时不使用 AFAIK
-
不,尽可能不加载 vcs 文件
-
是的,我做到了,结果证明我破坏了我自己的堆栈:forge.typo3.org/issues/91987#change-429005 如果你报告这样的错误(如果它是一个有效的错误),你需要一个补丁,因为在 oss 中它可能需要一段时间,直到问题获得补丁级别发布;)这个问题仍然有效
标签: composer-php diff patch