Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: prompt fun



On Mon, 11 Oct 1999, Adam Spiers wrote:

> Bart Schaefer (schaefer@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> > 
> > Run the "cvs diff" output through this:
> > 
> > 	sed -e '/^RCS/,/^---/d' -e '/^\+\+\+/d'
> 
> What if a line within the hunk begins with `--' or `++' though?

Removed lines beginning with "--" shouldn't be a problem, as there won't
be more than one line beginning with "RCS" for any file, and there must be
a line beginning with "---" above all hunks for each file in either diff
format.

Added lines beginning with "++" would cause patch to fail with a warning
about a malformed diff.  I think that's probably a pretty rare occurrence
(since we're almost exclusively patching shell script and C source), but
you could make the pattern more detailed if you're concerned:

    -e '/^\+\+\+ .* [0-9]+:[0-9]+:[0-9]+/d'

That forces there to be a space after the "+++" and something that looks
like a time on the line as well.  Get as precise as you like ...



Messages sorted by: Reverse Date, Date, Thread, Author