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

Re: [RFC/PATCH v3 4/5] Rename "crlf" attribute as "eolconv"

From
Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>
Date
May 14, 2010, 21:16 UTC
Message-ID
<7DF58EB2-F6A0-47FB-BC89-72757B29FAE6@gmail.com>
In-Reply-To
<alpine.LFD.2.00.1005131438330.3711@i5.linux-foundation.org>
On 13. mai 2010, at 23.45, Linus Torvalds wrote:
Show 6 quoted lines
> On Thu, 13 May 2010, Eyvind Bernhardsen wrote:
>> 
>> Do you agree that "native" eol should only be CRLF if autocrlf is true?  
> 
> Not really. We're trying to get _away_ from .gitattributes depending on 
> autocrlf, aren't we?
I'm not sure we still are.  I certainly was when I started this series, but that was because autocrlf just plain didn't work with many existing repositories.  When "safe autocrlf" fixed that, I decided that the extra complexity of core.eolStyle wasn't worth it.
I could be wrong, and I'd be happy to add it later.  I don't think this series requires it, though.
I'd like to make my terms explicit: when I say "core.autocrlf", I mean a config value that makes git normalize all text files automagically.  "core.eol" would be a different config value that simply tells git what line endings to put in files that are explicitly flagged as "text" (or automatically detected by "text=auto").
Show 10 quoted lines
>> Otherwise, if .gitattributes looks like this:
>> 
>> 	*.txt text
>> 
>> git will put CRLFs in .txt files but LFs in .c files, and I don't think 
>> that makes much sense.
> 
> Well, but that's what you asked for, isn't it? And I don't see why you say 
> *.c files would have LF's, since that depends on what you put in them: and 
> under Windows, that might well be CRLF.
That's not an interesting problem.  If you're okay with CRLFs in your repository there's no need for you to use text file normalization at all, and you're certainly not going to bother to set any text attributes.  Everything will Just Work.
To make it more relevant, let's consider what would happen if you suddenly wanted to share that repository with a Linux user.  You would clearly have been better off if the text files had been normalized, but I can only see three ways this could happen:
1. You set "* text=auto" when you created the repository
2. text=auto is the default for all files
3. autocrlf=true is set by default on Windows
The first option is unrealistic, and we probably agree that the second one is a bad idea.  That's why, once Finn Arne fixed autocrlf, I realized it's not all that bad.
Show 10 quoted lines
> And I do think it's perfectly reasonable to override the "native" mode in 
> your .git/config. If we're renaming the attributes, we might as well then 
> introduce a 
> 
> 	[core]
> 		eol=lf
> 
> to set the "native" EOL for that repo, exactly because presumably a number 
> of Windows people would like to see the saner LF-only model rather than 
> the traditional native CRLF.
But they can equally easily set "core.autocrlf=false".  Although the name still grates.
> In fact, maybe it would even make sense to just make LF the default 
> "native" end-of-line sequence even on windows, so that Windows people who 
> actually want CRLF would have to set core.eol=crlf. Whatever. That would 
> be for the Windows git users to fight out, I don't care.
This is the crux of the problem.  It's possible that I'm just being prejudiced, but I think that if someone wants CRLF as a _default_ they probably want it to be the default for all text files, not just normalized ones.
> But if we are going to clean up text attribute handling, then I really 
> think we want to totally break that old "core.autocrlf" dependency.
"core.autocrlf=true" is exactly equivalent to "core.eol=crlf" in a repository with "* text=auto" (setting the "text" attribute disables the index check).
In a repository that doesn't care, "core.autocrlf=true" will normalize your text files and put CRLFs in them, while "core.eol=crlf" won't do a thing.
Unless you're simply arguing for renaming autocrlf to eol?
-- 
Eyvind
Previous: Eyvind BernhardsenNext: Linus Torvalds
Message 23 of 27 in “End-of-line normalization, redesigned”
  1. 0/5 End-of-line normalization, redesignedEyvind Bernhardsen, May 12, 2010
  2. 1/5 autocrlf: Make it work also for un-normalized repositoriesEyvind Bernhardsen, May 12, 2010
  3. 2/5 Add tests for per-repository eol normalizationEyvind Bernhardsen, May 12, 2010
  4. 3/5 Add per-repository eol normalizationEyvind Bernhardsen, May 12, 2010
  5. 4/5 Rename "crlf" attribute as "eolconv"Eyvind Bernhardsen, May 12, 2010
  6. Linus TorvaldsMay 13, 2010
  7. Robert BuckMay 13, 2010
  8. Robert BuckMay 13, 2010
  9. Eyvind BernhardsenMay 13, 2010
  10. Robert BuckMay 13, 2010
  11. utf8 BOMDmitry Potapov, May 14, 2010
  12. Eyvind BernhardsenMay 15, 2010
  13. Dmitry PotapovMay 16, 2010
  14. Eyvind BernhardsenMay 16, 2010
  15. TaitMay 16, 2010
  16. Dmitry PotapovMay 16, 2010
  17. Eyvind BernhardsenMay 13, 2010
  18. Linus TorvaldsMay 13, 2010
  19. Robert BuckMay 14, 2010
  20. Jonathan NiederMay 14, 2010
  21. Eyvind BernhardsenMay 14, 2010
  22. Eyvind BernhardsenMay 14, 2010
  23. Eyvind BernhardsenMay 14, 2010
  24. Linus TorvaldsMay 14, 2010
  25. Add "core.eol" variable to control end-of-line conversionEyvind Bernhardsen, May 15, 2010
  26. Robert BuckMay 16, 2010
  27. 5/5 Rename "core.autocrlf" config variable as "core.eolconv"Eyvind Bernhardsen, May 12, 2010

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.