-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding .gitattributes #341
Comments
What are the consequences for OS that have another line ending / break? |
I just tried on Windows 10, and spotless changed all line-endings to LF. |
Hmm never had this issue, but I have configured my Git to checkout LF for system, but keep the original LF for commiting/check in |
As the Git documentations says, that's because:
|
The spotless authors suggest the use of I looked at diffplug/spotless#22, but I could not figure out if there is a way to just configure the plugin itself to handle line endings. In my repository, I have used Another issue unrelated to spotless is that when using GitHub CI on Windows, it automatically changes all files newlines on checkout, and I couldn't figure out how to configure this, see actions/checkout#135. |
To make a long story short, if you're already on Linux or macOS, then you shouldn't notice any change with this. But, if you're on Windows, then this will fix the build for you and stop changing the newlines on all the source files (which for me are not the files that are checked out, but the ones that end up in the build tree). Since even people on Windows don't want this Git "feature", I wonder if anyone does. The only thing to look out for is that if you ever need a Windows-specific file, you should add the file (or file extension) to the |
Thanks @Michael1993 and @dwalluck for bringing this up. See #347 for my proposed solution. |
As observed in #341, without further configuration, Git uses the OS default line ending (LF on Unix, CRLF on Windows) when writing files to the working directory, e.g. during checkout. If other tools aren't aware of that and edit line endings, the resulting diff is noisy. Specifically this happened in #341, where Pioneer was checked out on Windows (~> CRLF) and Spotless changed all line endings (to LF). This change creates a `.gitattributes` file with the following settings: # all end-of-lines are normalized to LF when written to the repository # https://git-scm.com/docs/gitattributes#_text * text=auto # force all text files on the working dir to have LF line endings # https://git-scm.com/docs/gitattributes#_eol * text eol=lf Closes: #341 PR: #347
To make JUnit Pioneer (and spotless) work more seamlessly, we should consider adding a
.gitattributes
file.Specifically I am thinking about adding an option for line-endings (e.g.:
* text eol=crlf
).The text was updated successfully, but these errors were encountered: