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

Re: suggestion for improved docs on autocrlf

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2019, 15:46 UTC
Message-ID
<xmqqo90ubd3g.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<64c0a35825af4ff3956c6c9a5fb748bb@bofa.com>
"Yagnatinsky, Mark" <mark.yagnatinsky@bofa.com> writes:
Show 8 quoted lines
> Wait a second... suppose a file is committed with CRLF line
> endings.  You're saying that even if I have autocrlf set to
> "input" or "auto", the file will never get "converted" to LF
> format unless I explicitly renormalize?  That sounds like a fairly
> sensible behavior, but it's not what I've observed in the past at
> all!  There have been plenty of times when I had "autocrlf" set to
> input which resulted in me changing line endings on commit I had
> no intention of changing!

Isn't that merely an effect of the fact that git add does not bother with paths it knows unmodified, and the decision it makes if a path is modified does not involve if the path's contents predate what you have in the current .gitattributes and .git/config?

If you had committed two paths with CRLF, checked them out, flipped the attribute so that they would be converted upon input, modified one of them but not the other, and say "git add .", because the relative age of .gitattributes and file contents do not get in the picture, "git add ." would say "Ah, you have one modified file, so we need to add its new contents to the index. And you are telling me to convert its line endings to LF while doing so."

Previous: Yagnatinsky, MarkNext: Yagnatinsky, Mark
Message 9 of 23 in “suggestion for improved docs on autocrlf”
  1. Yagnatinsky, MarkAug 7, 2019
  2. Torsten BögershausenAug 8, 2019
  3. Yagnatinsky, MarkAug 8, 2019
  4. Yagnatinsky, MarkAug 8, 2019
  5. Torsten BögershausenAug 9, 2019
  6. Yagnatinsky, MarkAug 9, 2019
  7. Torsten BögershausenAug 11, 2019
  8. Yagnatinsky, MarkAug 12, 2019
  9. Junio C HamanoAug 12, 2019
  10. Yagnatinsky, MarkAug 12, 2019
  11. Torsten BögershausenAug 12, 2019
  12. Yagnatinsky, MarkAug 12, 2019
  13. Junio C HamanoAug 12, 2019
  14. Yagnatinsky, MarkAug 12, 2019
  15. Torsten BögershausenAug 13, 2019
  16. Yagnatinsky, MarkAug 13, 2019
  17. Torsten BögershausenAug 13, 2019
  18. Yagnatinsky, MarkAug 13, 2019
  19. Yagnatinsky, MarkAug 14, 2019
  20. Yagnatinsky, MarkAug 15, 2019
  21. Torsten BögershausenAug 16, 2019
  22. Yagnatinsky, MarkAug 16, 2019
  23. Junio C HamanoAug 13, 2019

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.