Document directory
- Create a patch file:
- -P0 or-P1? Directory level of the patch command:
Maybe I am a stupid person. Every time I encounter a bug, although someone provides a patch, I don't know how to use it. Manual page (man patch) only provides the usage of patch-P (Num) <patchfile, and does not know how to determine num. If you have such doubts, please continue reading. The following content is from here
Create a patch file:
Diff-Naur olddir newdir> New-patch
-Or-
Diff-Naur oldfile newfile> New-patch
-P0 or-P1? Directory level of the patch command:
The-P option can selectively intercept the directory hierarchy of the patchfile. For example, if your patchfile header is like the following:
--- Old/modules/pcitable mon Sep 27 11:03:56 1999
++ New/modules/pcitable Tue Dec 19 20:05:41 2000
Use-P0 to search for a new sub-folder under your current path, search for "modules" under "new", and then find "pcitable" under it ".
Use-P1 to truncate the first directory, that is, the patch will directly search for "modules" in the current path, and then "pcitable"
And so on.
It is actually very simple.