Splitting up the 'mega' patches

Dagmar d'Surreal no.spam at allowed.here
Fri Jan 3 13:55:27 PST 2003

On Fri, 2003-01-03 at 02:03, Erika Pacholleck wrote:
> [02.01.2003] Gerard Beekmans <-- :
> > On January 2, 2003 04:41 pm, Mark Lee wrote:
> > > Is it possible to put comments in the patch files themselves? It would be
> > > really nice if the patches were self-documented. Maybe this isn't possible
> > > (I don't know enough about patches so I apologize if I'm wasting your
> > > time).
> > 
> > Now, you can't put comments in a diff file like you do normally in files 
> You can do it this way:
> *** put all explanations here **************
> explanations as follows:
> - file1 changes unpatched to patched
> - file2 changes also unpatched to also patched
> *** end of explanations ********************

Erika is completely correct about this, although putting '-' signs at
position 1 in the lines runs the risk of confusing the patch binary,
since these have special meaning (and not just '---').  The man page
refers the reader to an RFC <1000 for more detail.

What I've seen done in the past was that the author of a patch would put
comments explaining the revision at the top of the section they applied
to, and prefixed each line with '!'.  After rummaging through the source
to patch and not finding much that was easily readable, I came to the
conclusion that this might be patch's version of a comment marker based
on the fact that patch never seems to complain about leading or trailing
garbage when you do this, it is pleasing to the eye in the output of
patch when invoked with --verbose, and vim syntax highlighting thinks
it's special enough to warrant being made purple.  ;)  A perfect example

root at evil:/space/tmp$ patch -p0 --verbose < cp1252fixes.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
|! This patch alters the broken configure check in configure.in and will
|! require you to re-run autoconf.
|diff -Naur pilot-link-0.11.6-orig/configure.in
|--- pilot-link-0.11.6-orig/configure.in    2002-12-24
19:46:13.000000000 -0600
|+++ pilot-link-0.11.6/configure.in     2003-01-03 15:32:54.000000000
Patching file pilot-link-0.11.6/configure.in using Plan A...
Hunk #1 succeeded at 246.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
|! This patch just flat out fixes the broken configure test.
|diff -Naur pilot-link-0.11.6-orig/configure pilot-link-0.11.6/configure
|--- pilot-link-0.11.6-orig/configure       2002-12-24
20:53:49.000000000 -0600
|+++ pilot-link-0.11.6/configure        2003-01-03 15:35:56.000000000
Patching file pilot-link-0.11.6/configure using Plan A...
Hunk #1 succeeded at 7092.

You can still combine commented patches by simply concatenating them all
down to one file (when doing unified diffs anyway), provided they appear
in the file in the same order they would normally be applied.

In any case, I am *all for* commenting patches used here, because the
one thing that really drives me crazy about patches is trying to figure
out where I got them, who made them, or what the heck they do at some
later date.  :)

(Oh, the patch above has now been applied to pilot-link CVS)

Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message

More information about the lfs-dev mailing list