Silly Patch Question

DJ Delorie dj@delorie.com
Wed Nov 8 09:35:00 GMT 2000


You might need the "-p0" option of patch, otherwise it strips off
directory names.

Plus, "cvs diff" strips directory names too.  I have a script
that puts them back on.  Do "cvs diff -p2 ... | FixPatch > file.txt"

#!/usr/bin/perl
# -*- perl -*-

while (<>) {
    s/\r//;
    if (/^Index: (\S+)/) {
	$full = $1;
    }
    if (/^(diff .* )\S+/) {
	$_ = "$1 $full\n";
	$header = 1;
    }
    if ($header) {
	$header = 0 if /\*\*\*\*/;
	s/^--- \S+/--- $full/;
	s/^\+\+\+ \S+/\+\+\+ $full/;
	s/^\*\*\* \S+/\*\*\* $full/;
    }

    print;

}


More information about the Cygwin-developers mailing list