eol=crlf doesn't affect a .cs file

31 Views Asked by At

git v2.30.2.1 I have a checked-in C# file that contains a mix of LF and CRLF line endings. So I checked in a .gitattributes file to the repo containing:

* text=auto eol=crlf

But when I check out the branch the C# file does not get converted to CRLF. In Notepad++ I can see the mixed line endings. This returns false for that file:

File.ReadAllText(fullPath).Any(c => c == '\0');

So I don't think git would have any reason to treat it as binary. What else could be preventing the file from being converted to CRLF?

As an experiment, I checked in a dummy.cs file containing all LF endings. When I check the branch out, that file gets converted to CRLF. So it seems the .gitattributes is functioning for some files.

0

There are 0 best solutions below