Skip to content
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

Relax: Fix git attributes allowing platform native usage #2481

Closed
hazendaz opened this issue Jul 22, 2023 · 6 comments
Closed

Relax: Fix git attributes allowing platform native usage #2481

hazendaz opened this issue Jul 22, 2023 · 6 comments
Assignees

Comments

@hazendaz
Copy link
Member

Today spotbugs forces *nix line endings on files. This ignores windows users. As a result, many files were so messed up on windows for me at least that I had to run spotless constantly to get a build to work. If I use notepad for example to open files like these, they are not readable. So we need to respect windows users properly. Let git checkout as suggested instead of being heavy handled mac / unix so we get more broad support from contributors.

@hazendaz hazendaz self-assigned this Jul 22, 2023
@welcome
Copy link

welcome bot commented Jul 22, 2023

Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.

@hazendaz
Copy link
Member Author

Adding to this..what I really mean is 'git checkout on windows better use windows line endings'...or in other words whatever the platform checked out on uses as is generally advised when using cross platform development. Checking out as *nix regardless is ill advised even from suggestions in usage in such this scenario. We need to make this easy not a pain. I'm going to do the work here at some point and this ticket only serves as a reminder since I nixed all my files now.

@iloveeclipse
Copy link
Member

Today spotbugs forces *nix line endings on files

How exactly?

Let git checkout as suggested

Which would be what exactly?

CRLF is a mess invented by Windows, and it is good it is forced by project (however I'm not aware how exactly that is done).

So if you have troubles with Windows, probably you can try to set git config --global core.autocrlf true as proposed here: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings?platform=windows

@hazendaz
Copy link
Member Author

hazendaz commented Aug 4, 2023 via email

@hazendaz
Copy link
Member Author

hazendaz commented Aug 4, 2023 via email

@hazendaz
Copy link
Member Author

Cleanup gitattributes switching text to auto.

Resolved by #2343 and more specifically for those that see this, do the following on windows...

For developers using windows, run 'git add . --renormalize' and see https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings if needed.

Problem is that the global as noted by @iloveeclipse git config --global core.autocrlf true is exactly what I use and I'm sure many in windows would use. That trumps the project settings so it doesn't care that project was suggesting unix line endings.

To further complicate things, the issue seems rooted with spotless usage. There is some classpath issue but overcame that by using configuration noted with spotless gradle plugin. On this repo, its been impossible to upgrade spotless due to this since 6.14.0, The issue that resolves this is now on latest 6.22.0. Spotless itself was telling the project to not listen to spotless direction and override line endings also to unix.

Far too often we get PRs coming in with line endings messed up. A lot of this contributes to that. Fixing it didn't cause any direct change to line endings itself as far as git is concerned in the repo. Its still what it should be, its just no longer hard-forcing users in windows to have to make unnecessary choices that conflict with git standards.

The final key here was simply rewiring spotless correctly per their suggestions, leveraging what the gradle plugin used since it was up to date, then fixing up the git attributes. From a user perspective it should be simple to fix up on their local and this has been added to changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants