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?
You can use the “filterdiff” utility – http://man.cx/filterdiff – from http://packages.debian.org/patchutils to do that.
Otherwise, just pressing Enter a lot will also help ;-)
You can use filterdiff
from the patchutils
package.
-x *PATTERN*, --exclude=*PATTERN*
Exclude files matching PATTERN. All other lines in the input are displayed.
So for your example
filterdiff -p1 -x 'var/packages/*' < the.patch | patch -p1
Alternatively you can manually edit the patch to remove the unwanted files, but this make take some time if it's very large.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With