[TriLUG] Re: Diff questions

James Manning jmm at sublogic.com
Mon Nov 4 12:34:57 EST 2002


> [Jeremy Portzer]
> Normally, the command is 
> 	patch -p0 < filename.diff
> 
> Make sure you are cd'd into the source directory before running
> that. 

not that it matters, but normally if you're above the src dir, it's
-p0 (since the convention, at least from what i've seen, is that
diff's are made one above the src dir, like "diff -ruN linux.orig/
linux.new/" or whatever.  Hence, if you're inside the src dir, by this
convention you'd need to -p1 to strip off the linux/ part of the diff
file before applying the patch.

IMHO, patch should really find the first non-new file (file with
additions with pre-existing lines or one with deletions and
therefore, required to already exist) and try to figure out the -p
number if not already provided based on stat'ing it relative to
current with parents stripped off til a match is found.  Worst-case,
spit out said results as a suggested -p value for a second patch run.

(expecting the normal response) I'll add it on the end of my todo list
:)

James
-- 
James Manning <http://www.sublogic.com/james/>
GPG Key fingerprint = B913 2FBD 14A9 CE18 B2B7  9C8E A0BF B026 EEBB F6E4



More information about the TriLUG mailing list