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

How to have EOL=LF and keep binary files auto-detection?

From
Kirill Likhodedov <kirill.likhodedov@jetbrains.com>
Date
Apr 25, 2016, 14:11 UTC
Message-ID
<3670335C-4938-4DCD-9B1D-6B4737CBE6C2@jetbrains.com>
Hi, 
I wonder if it is possible both to have LFs in all and only text files in working trees, and keep Git’s binary files auto-detection?
To be more precise:
* we want all text files to be checked out in LF; 
* we don’t want force people to set “core.autocrlf” to false, preferring to keep this configuration in .gitattributes; 
* we obviously don’t want binary files to be touched by eol-normalization; 
* we also don’t want to declare all possible patterns of binary files - Git is good enough in detecting them automatically.
However, I’ve found no way to do so.
If I declare `* eol=lf` in .gitattributes, it makes Git treat all files as text and thus convert CRLF to LF even in binary files. It is consistent with man, but a bit surprising to have e.g. a zip or png file modified in this way.
One could expect `* text=auto eol=lf` to work the way we want, but unfortunately it doesn’t work either: “eol=lf” forces “text” on all files.

Thanks a lot for your help! -- Kirill.

Next: Torsten Bögershausen
Message 1 of 3 in “How to have EOL=LF and keep binary files auto-detection?”
  1. Kirill LikhodedovApr 25, 2016
  2. Torsten BögershausenApr 25, 2016
  3. Nikolay ChashnikovApr 26, 2016

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.