Dave,
I think you just need to add a line as follows to commitinfo:
^mymodule $CVSROOT/CVSROOT/scripts/check-crlf
We use the following perl script which works for both client/server
and regular file access.
#!/usr/bin/perl
$ignore =
"(\.doc)|(\.ppt)|(\.mak)|(\.cpp)|(\.hpp)|(\.cdf)|(\.iwz)|(\.txt)";
foreach my $i (@ARGV) {
next if ( $i =~ m/$ignore/ );
if ( open( i,$i ) ) {
my $lineno = 0;
while ( <i> ) {
if ( m/\015$/ ) {
die "CR/LF line ending found in $i line
$lineno\n";
}
$lineno++;
}
}
else {
# don't die on missing file - might be a remove!
}
}
And yes, I know it's evil to check binary files into CVS (.doc,.ppt)
but at the time the script was written we had not found the one
true cvs way :-)
Dave Makower writes:
> From what I can see browsing the archives at
> http://www.egroups.com/list/info-cvs/, at least two people have asked
> the question I'd like to ask, but I can't find any answers. My
> apologies if I've overlooked it.
>
> I would like a script called from commitinfo to examine the contents
> of committed files, making sure they don't have DOS-style line
> endings. It's a one-line perl script to do the check, but what I
> can't figure out is, how can I get access to the _contents_ of a file
> as it's on its way to be committed. I thought it might be in
> $CVSROOT/mymodule/mydir/myfile, but it doesn't seem to be there. I
> can get the commitinfo script to say "looking in $dirname" and
> "checking $filename", and they look right, but it seems that the file
> is not there.
>
> The CVS manual (or was it http://cvsbook.red-bean.com/ ?) says that
> you can inspect the contents of the file, but nothing seems to say
> exactly how that can be accomplished.
>
> (Note: I'd like a solution that works for client/server commits, so
> finding the file in the user's working directory is not preferable.
> However, if it's the only way, then I would do that.)
Regards!
Luke Diamand
--
Virata http://www.virata.com