How to make patch(1) use the answer with +++ instead of asking

29 views Asked by At

I have generated a large patchset, and when I am trying to apply it with "patch -Np1 -i ", it shows something like this:

can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- src    2024-03-09     15:47:51.145613870 +0100
|+++ dest   2024-03-09     16:03:27.723860711 +0100
--------------------------
File to patch:

When I manually enter the name of the file with "+++", it works as inded, but there are many files in this patchset, and it just takes so long to copy and paste the filename, which is already known by patch(1).

I tried using -t, but only what it did is it didn't apply any patches at all.

Is there a way to make patch automatically use the file with three pluses as the file to patch?

Thanks in advance.

1

There are 1 answers

0
Joseph Sible-Reinstate Monica On

-p1 means to strip one layer of directories off of the filename before trying it. Since you don't have such a directory, patch didn't know what you meant. Use -p0 instead to not strip anything.