3

I have a patch file for some software (Magento) and want to apply it to my current project.

The patch file contains also references to files in the var/packages folder which I do not want (I deleted this folder in my installation).

When applying this patch file (patch -p1 < the.patch), I get lots of warnings like:

The next patch would delete the file var/package/Foo_Bar.1.7.0.0.xml,
which does not exist!  Assume -R? [n] ^C

Is there any way to tell the patch command to just ignore patches for this folder?

4

2 回答 2

2

您可以使用http://packages.debian.org/patchutils中的“filterdiff”实用程序 - http://man.cx/filterdiff -来做到这一点。

否则,只需按 Enter 很多也会有帮助;-)

于 2013-07-24T14:57:16.863 回答
-1

您可以filterdiffpatchutils包装中使用。

-x *PATTERN*, --exclude=*PATTERN*

排除匹配PATTERN的文件。显示输入中的所有其他行。

所以对于你的例子

filterdiff -p1 -x 'var/packages/*' < the.patch | patch -p1

或者,您可以手动编辑补丁以删除不需要的文件,但如果它非常大,这需要一些时间。

于 2019-10-02T16:39:13.490 回答