Hi
I usually work on macos and linux, but unfortunately there are less lucky gals who need to work on Windows boxes too.
For those on Windows, I just noticed that Studio creates files with the LF line ending, despite being on Windows. I would expect it to create most of the files with the CRLF line ending (with some exceptions, like .sh
files and such).
That’s not ideal, but it could be fine if it consistently uses LF for all the files it creates, but unfortunately it’s not the case.
For example, after inspecting some files created in a new test project, I noticed that the file modules\core\src\com\company\app\core\messages.properties
has been created with the CRLF line ending, while the other files in the core
module have the LF line ending.
This is really bad for Git, because inconsistent line endings means trouble when sharing projects between macos/linux and Windows.
I think that Studio should respect the native line endings of the underlying S.O., like Git does with the core.eol = native
config. In addition, it should create a default .gitattributes
file for a new project, with sane default values for the main files in it (see a sample at the end of the post).
If that’s not possible, at least try to be consistent, and never mix LF and CRLF line endings like it does in the current version.
Thx
Paolo
APPENDIX: sample .gitattributes
file (expand at will)
# Set behaviour for all files, and override core.autocrlf
* text=auto
# Explicitly declare text files we want to always be normalized and converted to native line endings on checkout.
*.txt text diff
*.exp text diff
*.yml text diff
*.js text diff
*.md text diff
*.MD text diff
*.gitignore text diff
*.gitattributes text diff
# Declare common diff patterns for specific file types
*.htm text diff=html
*.html text diff=html
*.java text diff=java
# Declare files that will always have CRLF line endings on checkout.
*.ps1 text diff eol=crlf
*.bat text diff eol=crlf
*.cmd text diff eol=crlf
# Declare files that will always have LF line endings on checkout
*.sh text diff eol=lf
*.command text diff eol=lf
package.json text diff eol=lf
# Prevent EOL conversions (but treat as text)
tsd.json -text
repositories.config -text
packages.config -text
.idea/**/*.xml -text
# Denote all files that should be treated as binary and should not be modified.
*.zip binary
*.ai binary
*.svg binary
*.pdf binary
*.jpg binary
*.png binary
*.bmp binary
*.psd binary
*.iml binary
*.plist binary