-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Added .gitattributes to manage end-of-line checks for Windows/*nix systems #1638
Conversation
Can one of the admins verify this patch? |
✅ Gradle Wrapper Validation success 6e078d3293a62a20b9867fd360901fe09ecfbebd |
✅ Gradle Precommit success 6e078d3293a62a20b9867fd360901fe09ecfbebd |
❌ Gradle Check failure 6e078d3293a62a20b9867fd360901fe09ecfbebd |
✅ Gradle Wrapper Validation success 82f707c93d9ed1ccba0b81a77c569c16f0aeb1e2 |
✅ Gradle Precommit success 82f707c93d9ed1ccba0b81a77c569c16f0aeb1e2 |
❌ Gradle Check failure 82f707c93d9ed1ccba0b81a77c569c16f0aeb1e2 |
+1 on @owaiskazi19 question, we should have consistent CR/LFs in code regardless of whether someone edited a file on Windows or *nix |
✅ Gradle Wrapper Validation success ebc8654bcec9cfaf79657365edb9157b497812af |
✅ Gradle Precommit success ebc8654bcec9cfaf79657365edb9157b497812af |
@dblock @owaiskazi19 yes, sure:
Here is the diff:
PS: running it on |
Thanks for the output. Since |
❌ Gradle Check failure ebc8654bcec9cfaf79657365edb9157b497812af |
@owaiskazi19 I think you are mistaken The task which fails is |
✅ Gradle Wrapper Validation success b581e54232a426539d2101e1894b7c86c5b7d8eb |
Sorry if I was not clear @reta. I meant since we had a successful run of SpotlessApply, can't we just raise a PR for that formatted change instead of adding |
I suspect if we fix Windows formatting, than |
✅ Gradle Precommit success b581e54232a426539d2101e1894b7c86c5b7d8eb |
❌ Gradle Check failure b581e54232a426539d2101e1894b7c86c5b7d8eb |
I'm not sure if it will break on *nix for this specific case. Can you give it a try? |
✅ Gradle Wrapper Validation success ebf5367908e461e7747f7c612cd125902eb74b86 |
✅ Gradle Precommit success ebf5367908e461e7747f7c612cd125902eb74b86 |
I will, sure
Nope, it is a default for a long time: diffplug/spotless#23 |
@owaiskazi19 expectation matches, have a branch for you, https://github.com/reta/OpenSearch/tree/issue-1637.apply, what I did On Windows:
On Linux:
Commit in question: reta@d4e6619 |
…stems Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
@@ -0,0 +1,2 @@ | |||
* text eol=lf | |||
*.bat text eol=crlf |
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.
Keeping bat
files Windows compatible is probably good idea
✅ Gradle Wrapper Validation success 37fad89 |
✅ Gradle Precommit success 37fad89 |
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.
Based on diffplug/spotless#39. This LGTM.
I am still not sure why are we running The way I was thinking for #1637 is to run SpotlessApply and push those changes. That'll have a successful SpotlessJavaCheck. To make sure the build is fine, run: Windows: Linux: We won't need |
@owaiskazi19
Please go ahead, as I explained to, I did that and I have a branch with those changes pushed, https://github.com/reta/OpenSearch/tree/issue-1637.apply, you are welcome to pull it and run |
Will it or will it start breaking on *nix? If yes, let's do that instead of modifying .gitattributes? I am honestly not sure what "the right thing to do" is. |
@dblock it fails for me on *nix, passes on Windows. |
That's what I thought. Spotless needs to be told to be LF on Windows, which is done in this PR. I'm going to merge this. |
@owaiskazi19 Did I miss anything? Merge? |
@dblock fyi, just to point out a few references, all related to |
Since Spotless copies git's behavior. This change will set Spotless to use LF and that's it. |
Thanks @owaiskazi19 ! |
@dblock sorry, I am a bit confused by "backport" process, is it automated or still manual? (I don't see backport pull request to 1.x) |
Hi @reta, it is automated but the label This is an example of how it should run VachaShah/TestGithubActions#6 (its a test repo I have) here I added the |
@VachaShah ah ... this is what I suspected, thank you, AFAIK external contributors do not have permissions to add labels (at least, that was certainly true before not long ago). I will try to add one next time, thank you! |
…stems (opensearch-project#1638) Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Oh! I didn't know that. So if I see a PR that I want backported, I can't just label it and then merge? What should I do in that case? |
Yes you can add the label before the merge and wait for the workflow to run. The workflow will start running as soon as the label is added and finish in some seconds (I tried this on one of the PRs). Once it finishes, the PR can be merged and a backport PR will be opened automatically. For the previous PRs, the workflow was not running as the Github action was not added in the list that is allowed to run. It works now successfully. |
Signed-off-by: Andriy Redko andriy.redko@aiven.io
Description
There is a difference between end of line CRLF vs LF between Windows/*nix systems which causes
spotless
checks to fail. The suggested solution is to use.gitattributes
, see please diffplug/spotless#23Linux:
Windows:
Issues Resolved
Closes #1637
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.