git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
IHIan Hilt <ian.hilt@gmx.com>
Date
Jun 24, 2008, 19:54 UTC
Message-ID
<alpine.LFD.1.10.0806241548140.32759@sys-0.hiltweb.site>
In-Reply-To
<m363rylknc.fsf@localhost.localdomain>
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
Previous: Jakub NarebskiNext: Jakub Narebski
Message 5 of 21 in “pre-commit hook should ignore carriage returns at EOL”
  1. pre-commit hook should ignore carriage returns at EOLChristian Holtje, Jun 24, 2008
  2. Alf ClementJun 24, 2008
  3. Ian HiltJun 24, 2008
  4. Jakub NarebskiJun 24, 2008
  5. Ian HiltJun 24, 2008
  6. Jakub NarebskiJun 24, 2008
  7. Ian HiltJun 24, 2008
  8. Christian HoltjeJun 24, 2008
  9. Junio C HamanoJun 24, 2008
  10. Christian HoltjeJun 24, 2008
  11. Jakub NarebskiJun 24, 2008
  12. Junio C HamanoJun 24, 2008
  13. Christian HoltjeJun 25, 2008
  14. Junio C HamanoJun 24, 2008
  15. Ship sample hooks with .sample suffixJunio C Hamano, Jun 25, 2008
  16. Junio C HamanoJun 25, 2008
  17. Johannes SixtJun 25, 2008
  18. Junio C HamanoJun 25, 2008
  19. Johannes SixtJun 26, 2008
  20. Junio C HamanoJun 26, 2008
  21. Peter BaumannJun 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.