CRLF unexpectedly converted to LF

Maybe it was just myself who made mistake, but, I’m currently scratching my head, because today, suddenly, I see that my JS file downloaded from GitHub/JSDelivr is unexpectedly converted from Windows-style CRLF to UNIX-style LF.

I published a release yesterday, and then purged JSDelivr cache of a JS file of it.

Today, I published yet another new release, then I found that the JS file from today’s new release has different line-endings - it should be Windows-style CRLF, but it is actually UNIX-style LF.

Then I downloaded the old JS from yesterday’s release - the one downloaded from JSDelivr has Windows-style CRLF, and the one downloaded from GitHub raw has UNIX-style LF.

I have disabled core.autocrlf for some time, therefore it’s surprising.

Hi @segfault-bilibili and welcome to the forum!

I would give the per repository settings a try.

The suggested change would be to your .gitattributes file by adding this line.

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
  • text eol=crlf Git will always convert line endings to CRLF on checkout. You should use this for files that must keep CRLF endings, even on OSX or Linux.

I have added that to my .gitattributes for quite some time.

The point was that: it seemed that GitHub had suddenly changed some policy to silently convert CRLF to LF, which explains why the same file from an old release downloaded from JSDelivr has CRLF (just as expected) while GitHub gives unexpetedly converted LF - JSDelivr cached such file before GitHub made such silent change.

Sorry, but maybe I no longer have time to track this issue.

Sorry this has caused you some frustration. Could you provide a link to your public repository where this is happening so we can continue to troubleshoot?

There has been no feature change that I can find related to what you are experiencing.

Thanks. Maybe it was actually related to JSDelivr rather than Github. Maybe it was just myself who misunderstood what “eol=crlf” means? It actually means automatic conversion (I don’t know when such conversion could happen, maybe it will convert LF->CRLF on checkout, and then convert CRLF->LF on commit?), which is not what I want.