-
Notifications
You must be signed in to change notification settings - Fork 509
Fixed some newline issues for running tests on Windows #180
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
Conversation
…ep handles them anyway.
…ight mask an issue in the future.
… and windows, we'll write a .gitattributes file to the root directory of every test folder.
…solutionTest in the past, but it's not necessary anymore.
|
Wow, thank you very much for having a go at this @nedtwigg. I was having quite a bit of trouble resolving this issue myself, so I'm glad that a working PR has been submitted. Apart from one thing which I'm confused about and will go over in a forthcoming review, I think this PR looks good. 👍 |
| @Before | ||
| public void gitAttributes() throws IOException { | ||
| write(".gitattributes", "* text eol=lf"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not so clear on what writing this .gitattributes file does. What do the other tests do with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default line ending behavior is to match git. We have a .gitattributes file so that spotless will checkout with \n on every platform.
Our GradleIntegrationTests create a folder in a temp folder, and run a gradle build there. Because those test folders don't have a .gitattributes file, git (on windows) will default to \r\n. So now if you read a test file from the spotless test resources, and compare it to a build result, the line endings won't match. We used to fix this in ResourceHarness by switching line endings to UNIX, which was dangerous. Now we do it buy sticking this .gitattributes file into the test directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, that makes sense to me now. Thanks for clarifying things for me!
In that case, this whole PR LGTM. 👍
|
Given the clarification in #180 (comment), I now fully understand and approve this PR. Ship it |
Spotless' CI only run on Linux, so it doesn't run on Windows very often. Spotless doesn't have any known Windows bugs, but if you checkout the Spotless repo and ran the tests, a lot of them would fail because of line-endings issues.
This fixes them.