Node:Multiple Patches, Next:patch Directories, Previous:Patching Time Stamps, Up:Merging with patch
If the patch file contains more than one patch, and if you do not
specify an input file on the command line,
patch tries to
apply each patch as if they came from separate patch files. This
means that it determines the name of the file to patch for each patch,
and that it examines the leading text before each patch for file names
and prerequisite revision level (see Making Patches, for more on
patch uses the following rules to intuit a file name from
the leading text before a patch. First,
patch takes an
ordered list of candidate file names as follows:
patchtakes the old and new file names in the header. A name is ignored if it does not have enough slashes to satisfy the
--strip=numoption. The name
/dev/nullis also ignored.
Index:line in the leading garbage and if either the old and new names are both absent or if
patchis conforming to POSIX,
patchtakes the name in the
patch selects a file name from the candidate list as
patchselects the first name if conforming to POSIX, and the best name otherwise.
patchis not ignoring RCS, ClearCase, and SCCS (see Revision Control), and no named files exist but an RCS, ClearCase, or SCCS master is found,
patchselects the first named file with an RCS, ClearCase, or SCCS master.
patchis not conforming to POSIX, and the patch appears to create a file,
patchselects the best name requiring the creation of the fewest directories.
patchselects that name.
To determine the best of a nonempty list of file names,
patch first takes all the names with the fewest path name
components; of those, it then takes all the names with the shortest
basename; of those, it then takes all the shortest names; finally, it
takes the first remaining name.
See patch and POSIX, to see whether
patch is conforming