Uh oh!
There was an error while loading. Please reload this page.
Add gitattributes file - #190
Conversation
| @@ -0,0 +1 @@ | |||
| * -text | |||
There was a problem hiding this comment.
| *-text | |
| *text=autoeol=lf |
Unless I am mistaken, this should force Git to convert file with CRLF endings to LF, whenever they are committed.
There was a problem hiding this comment.
The -text means leave unchanged, and yours means convert to lf. But, why do you want to convert Windows .bat, to lf`, for example?
We could leave the formatter to check on the pull request and assume the committer knows best.
There was a problem hiding this comment.
The project doesn't have any Windows files as far as I know, but you're saying if someone adds one they should also edit the .gitattributes file?
There was a problem hiding this comment.
I was more thinking about a Windows user that adds a Java file with CRLF and the CI "strangely" fails due to the Spotless check, but you are right, we should allow some CRLF files without modification of .gitattributes.
What about:
* -text
# Files checked by Spotless
*.java text eol=lf
pom.xml text eol=lf
and we add rules if we add Spotless formatters?
BTW: IIRC *.bat files should work with LF, cmd.exe ignores the CR unless I am mistaken. On the other hand shell files fail miserably if CRLF is used and the error message is quite confusing (due to the invisible character).
There was a problem hiding this comment.
Doesn't spotless also check some of *.json, *.sh, or *.yml?
I think it's going to get messy trying to match all files. We still have left even after all that:
Some dotfiles
LICENSE
README.md
There was a problem hiding this comment.
Doesn't spotless also check some of
*.json,*.sh, or*.yml?
Spotless can certainly do that too, although in #189 I only added a rule for Java files and the pom.xml.
I am not strongly opinionated on this matter. I think that auto-converting CRLF to LF in Java files could help some contributors, but I am fine in disabling auto-conversion altogether.
For me what matters the most is that builds on Linux can be reproduced on Windows and viceversa. As long as both systems check out identical files from Git, I am fine with either solution.
There was a problem hiding this comment.
@ppkarwasz I covered all existing files in the latest commit.
No description provided.