2

according to Force LF line endings using .gitattributes without losing automatic text/binary inference? when I set my .gitattributes to contain only

* text=auto
* text eol=lf

then all textfiles should be converted to LF line endings and binaries should be untouched - that's what I want. But somehow, binary files are not being detected properly here. See this output of git bash console under Windows:

$ git add .
warning: CRLF will be replaced by LF in clip2txt.exe.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in raw.png.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory

I would have expected, that raw.png and clip2txt.exe are being ignored as they are binaries. The file test will be proper converted, that is fine.

Have I missed something here?` thank you, br Alex

phd
  • 82,685
  • 13
  • 120
  • 165
Unfaced
  • 97
  • 8
  • AFAIU the accepted answer the second line is excessive. You need only the first one. – phd Nov 26 '18 at 13:07
  • If I only use * text=auto, then since i am on windows, it will try to convert all files to crlf which is not what i want – Unfaced Nov 26 '18 at 13:29
  • 1
    The second line makes **all files** text which is certainly not what you want. Try [`* text=auto eol=lf`](https://stackoverflow.com/q/29435156/7976758) in one line. – phd Nov 26 '18 at 14:46
  • 1
    Hmm, interesting. It was a short in the dark, and I'm glad it helped. – phd Nov 27 '18 at 09:59

1 Answers1

1

If anyone is looking into this, I mark it as answered:

Solution was to set .gitattributes to

* text=auto eol=lf

Thanks to @phd

Unfaced
  • 97
  • 8