Re: What should be the CRLF policy when win + Linux?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Thursday, May 6, 2010 - 10:15 am

On Thu, 6 May 2010, hasen j wrote:

A _lot_ of UNIX editors will handle CRLF endings, but if you change a 
file, they often write the result back with _mixed_ endings. Some will 
also show the CR as '^M' or some other garbage at the end.

A number of tools will also end up confused, including very fundamental 
things like "grep". Try this:

	echo -e "Hello\015" > f
	grep 'Hello$' f

and notice how the grep does _not_ find the Hello at the end of the line, 
because grep sees another random character there (this might be 
unportable, I could easily imagine some versions of grep finding it).

So I would strongly suggest against CRLF on UNIX. It really doesn't work 
very well, even if some tools will handle it to some limited degree.

In short: having 'core.autocrlf' set will likely make it much more 
pleasant to work across different platforms. 

			Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: What should be the CRLF policy when win + Linux?, Ramkumar Ramachandra, (Wed May 5, 6:27 am)
Re: What should be the CRLF policy when win + Linux?, Wilbert van Dolleweerd, (Thu May 6, 12:29 am)
Re: What should be the CRLF policy when win + Linux?, Erik Faye-Lund, (Thu May 6, 3:03 am)
Re: What should be the CRLF policy when win + Linux?, Linus Torvalds, (Thu May 6, 10:15 am)
Re: What should be the CRLF policy when win + Linux?, Erik Faye-Lund, (Thu May 6, 10:26 am)
Re: What should be the CRLF policy when win + Linux?, Linus Torvalds, (Thu May 6, 1:23 pm)
Re: What should be the CRLF policy when win + Linux?, Erik Faye-Lund, (Thu May 6, 1:40 pm)
[PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Thu May 6, 3:27 pm)
[PATCH/RFC 2/3] Add tests for per-repository eol normalization, Eyvind Bernhardsen, (Thu May 6, 3:27 pm)
[PATCH/RFC 3/3] Add per-repository eol normalization, Eyvind Bernhardsen, (Thu May 6, 3:27 pm)
Re: What should be the CRLF policy when win + Linux?, Erik Faye-Lund, (Thu May 6, 4:25 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Fri May 7, 12:23 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Fri May 7, 12:25 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Finn Arne Gangstad, (Fri May 7, 12:41 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Fri May 7, 1:11 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Fri May 7, 1:42 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Fri May 7, 2:17 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Fri May 7, 2:37 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, A Large Angry SCM, (Fri May 7, 3:09 pm)
Re: [PATCH/RFC 0/3] Per-repository end-of-line normalization, Eyvind Bernhardsen, (Sun May 9, 12:49 am)
Re: What should be the CRLF policy when win + Linux?, Anthony W. Youngman, (Tue May 18, 8:13 am)