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

Re: [RFR] gitattributes(5) documentation

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 20, 2007, 01:45 UTC
Message-ID
<alpine.LFD.0.98.0704191835290.9964@woody.linux-foundation.org>
In-Reply-To
<7vslav4yv6.fsf_-_@assigned-by-dhcp.cox.net>

Great. And reading the documentation, something struck me: wonderful docs about crlf, but it became clear that either the docs are wrong, or the behaviour is less than optimal: you cannot specify "crlf=input" any way?

So I would sugegst that
 - if crlf is set, we still honor the value of "core.autocrlf", we just 
   don't care about the *content*.

Maybe that's what the code is doing (I thought it did, but I'm too lazy to check), but the docs don't say that:

On Thu, 19 Apr 2007, Junio C Hamano wrote:
Show 6 quoted lines
> 
> Set::
> 	A path to which the `crlf` attribute is set is converted
> 	to have CRLF line endings in the working tree upon
> 	checkout, and converted back to strip CRLF line endings
> 	to LF line endings upon checkin.
This documented behaviour is non-optimal for a few reasons:
 - it makes it impossible to say "this is text", and have it work on UNIX 
   platforms ;)
 - it makes it impossible to have "autocrlf=input", and then correct one 
   single file that was incorrectly guessed to be binary, and have that 
   file behave like other files.
So I _think_ the right rules are:
 - unspecified: use autocrlf *and* content detection logic
 - unset: never do crlf<->lf ("binary")
 - set: use autocrlf without content detection logic ("text")
with possibly an added rule:
 - set to value: "true" or "input" force that particular setting 
   *regardless* of autocrlf, ie we'd always get CRLF even on UNIX.
Hmm?
			Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 32 in “What's cooking in git.git (topics)”
  1. Junio C HamanoApr 9, 2007
  2. Junio C HamanoApr 16, 2007
  3. Junio C HamanoApr 19, 2007
  4. Alex RiesenApr 19, 2007
  5. Nicolas PitreApr 19, 2007
  6. Martin WaitzApr 19, 2007
  7. Junio C HamanoApr 20, 2007
  8. Alex RiesenApr 20, 2007
  9. Sam RavnborgApr 20, 2007
  10. Martin WaitzApr 21, 2007
  11. Linus TorvaldsApr 21, 2007
  12. [RFR] gitattributes(5) documentationJunio C Hamano, Apr 20, 2007
  13. Linus TorvaldsApr 20, 2007
  14. Junio C HamanoApr 20, 2007
  15. David LangApr 22, 2007
  16. Junio C HamanoApr 22, 2007
  17. David LangApr 22, 2007
  18. Nicolas PitreApr 20, 2007
  19. Junio C HamanoApr 22, 2007
  20. Junio C HamanoApr 23, 2007
  21. Nicolas PitreApr 23, 2007
  22. Alex RiesenApr 23, 2007
  23. Junio C HamanoApr 23, 2007
  24. Alex RiesenApr 23, 2007
  25. Junio C HamanoApr 23, 2007
  26. Alex RiesenApr 24, 2007
  27. Johannes SchindelinApr 24, 2007
  28. Alex RiesenApr 24, 2007
  29. Johannes SchindelinApr 24, 2007
  30. Junio C HamanoApr 24, 2007
  31. Alex RiesenApr 25, 2007
  32. Johannes SchindelinApr 23, 2007

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.