Re: [PATCH] pre-commit hook should ignore carriage returns at EOL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ian Hilt <Ian.Hilt@xxxxxxx> writes:

> On Tue, 24 Jun 2008 at 12:23pm -0400, Christian Holtje wrote:

> > --- a/templates/hooks--pre-commit
> > +++ b/templates/hooks--pre-commit
> > @@ -55,8 +55,14 @@ perl -e '
> > 	if (s/^\+//) {
> > 	    $lineno++;
> > 	    chomp;
> > -	    if (/\s$/) {
> > -		bad_line("trailing whitespace", $_);
> > +	    if (/\r$/) {
> 
> Wouldn't it be less redundant to do a test for \s\r$ here instead of
> testing for \r$ and then \s\r$?

I don't think so, because you want next to test for whitespace
where it _doesn't_ end in \r, i.e. this condition is here
because of the 'else' clause.  IIRC.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux