Something keeps changing file newlines to CRLF

I changed the default in my PHPStorm at the IDE level to "Unix and MacOS (\n)" (LF right?),

and when I click the CRLF button at the bottom right of the file to change it to LF,

it saves and lets me commit that way (I'm assuming), but then the next day or so I come in and when I re-open the file it seems to randomly be CRLF again, screwing up my ability to stage "hunks" in git SourceTree (I get an error about patch will not apply), nevermind that another developer got the "wall-of-pink" issue once (look it up) because our previous developer used Windows and they didn't do `git config --global core.autocrlf true` as I do (so the file saved with CRLF even though we host on Linux and all now use Macs).

So... why does it keep switching to CRLF? Is it PHPStorm, or the Mac, or the file, or git, or SourceTree? I can't tell.

What's going on or what am I missing?

4

Same problem in intellij. And it happens of 'Frame deactivation'.

0

Frame deactivation saves the file & applies line ending settings.We need more information about the problem, e.g. your "Line separator" setting at File | Settings | Editor | Code Style, is it a locally stored project, are any other processes & users accessing this file, does it occur after a commit/save/etc?

0

Hi Dmitry. In my case I think I found the problem. Problem happens when EditorConfig  support enabled.

Posted it as bug https://youtrack.jetbrains.com/issue/IDEA-225911

Here by the way in phpstorm it also enabled according to first screen.

 

4

My line setting is in the original post and screenshot... "Unix and MacOS (\n)".

It stopped changing it back to CRLF a while ago though, not sure why.

May have been doing it when switching branches, but I already configured the recommended git line-ending configurations for converting to Linux newline on commit and the my OS when I checkout.

Honestly with PHPStorm, I'm not sure what the git config should be for line endings (in each repo and server) if our team is coding with Macs but eventually someone may code in Windows or Linux. We run our dev tests locally on Mac (which could be Windows or Linux eventually) and then QA and Prod run on Linux.

0

Mine just stopped doing it... not sure what caused it.

0

This is very much still happening. 

7

请先登录再写评论。