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

Improving CRLF error message; also, enabling autocrlf and safecrlf by default

From
JSJason Spiro <jasonspiro4@gmail.com>
Date
Feb 16, 2009, 02:45 UTC
Message-ID
<loom.20090216T022524-78@post.gmane.org>
Hi,
Thanks for writing git.  It's a darn useful tool.  But one thing:
One of the pre-commit hooks detects trailing whitespace:

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

Unfortunately, when I try to check in a file with DOS (CR+LF) line endings, this hook triggers on every line. This happens on Cygwin. I haven't checked, but I bet it happens on other platforms as well, as long as this hook runs.

But the error message "trailing whitespace" doesn't clearly tell me what's wrong.

1.  Could you please modify Git so that, when such a problem happens, it 
instead prints an message saying that the file has CR+LF line endings, and that 
Git does not allow this?
2.  In addition, could you please enable the core.autocrlf and core.safecrlf 
options by default in the next version of Git?

P.S. I hereby release the contents of this e-mail message to the public domain.

Thanks in advance, -- Jason Spiro: software/web developer, packager, trainer, IT consultant. I support Linux, UNIX, Windows, and more. Contact me to discuss your needs. +1 (416) 992-3445 / www.jspiro.com

Next: Jeff King
Message 1 of 7 in “Improving CRLF error message; also, enabling autocrlf and safecrlf by default”
  1. Jason SpiroFeb 16, 2009
  2. Jeff KingFeb 16, 2009
  3. Junio C HamanoFeb 16, 2009
  4. Jeff KingFeb 16, 2009
  5. Jason SpiroFeb 16, 2009
  6. Jeff KingFeb 16, 2009
  7. Junio C HamanoFeb 16, 2009

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.