Thread (11 messages) flat view 11 messages, 5 authors, 2016-06-15

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

From: Ian Hilt <hidden>
Date: 2016-06-15 22:44:49

On Tue, 24 Jun 2008 at 12:05pm -0700, Jakub Narebski wrote:
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.
What I'm suggesting is this,

	if (/\s\r$/) {
		bad_line("trailing whitespace", $_);
	} else {
		if (/\s$/) {
			bad_line("trailing whitespace", $_);
		}
	}

Why only test for \r when all you want to know is whether there is
whitespace before \r ?  If there isn't whitespace and \r at the end of a
line, then only test for whitespace at the end of a line.


-- 
Ian Hilt
Ian.Hilt (at) gmx.com
GnuPG key: 0x4AFC1EE3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help