-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add .gitattributes so line endings is consistent across systems #5731
Conversation
7a6b9c4
to
3026b5e
Compare
@trejjam can you click the "Allow edits from Maintainers"? We require branches to be up to date before merging, and without those rights, I can't rebase whenever we're ready to merge. |
3026b5e
to
4b784cc
Compare
Sure, somehow the option was not there when the repo was part of an organization |
4b784cc
to
a9f1568
Compare
Thanks for splitting this one out. I just checked and there's only one file existing in the repo with a CRLF ending:
Perhaps we'd want to specifically call out that file by name in this I did some reserach, and looks like Additionally, Microsoft changed Notepad from 2018 Windows 10 onward to support Unix / Mac line endings. And sounds like Visual Studio code will check out the files with CR+LF but then check them back in with LF (Unix ending) so existing files should be okay. Given the above, I'm not too concerned about existing files changing their line endings... so the main potential problem is if new files might be added from Windows-based contributors and put in the wrong line endings... I'm actually not too concerned about that given that we normally point folks at the Docker-based development experience, so for the most part they'll be on Linux and not Windows. And I assume that most devs who have enough experience to navigate the hurdles of running this code directly on Windows will also be experienced enough to be aware of line endings when contributing back to open source. So overall, I'd probably lean slightly towards not adding any of the wildcard lines right now--I think it doesn't really solve an existing problem, and instead could potentially cause confusion down the road. What say you @deivid-rodriguez ? |
a9f1568
to
67b5a00
Compare
Hi, I do no longer remember what was cause of this PR. But for sure it was based on making a PR on widows. Than I accidentally commit file with wrong line endings. It was "annoying" to go back and fix things, sure it can be fixed in different ways. I did not experienced any issues with this approach. |
As per the link you shared @jeffwidman, I believe I sometimes need to spin a Windows VM to troubleshoot things, and I've felt the pain of line conversion of Windows. So I'm happy to introduce any changes that makes lifes of Windows contributors easier. We can revert anything that does not work as expected if something happens to get in the middle. The current solution feels not great to maintain though. How about using this suggestion plus the specific call out to the one file we want to use crlf. It'd be something like this I guess:
|
The idea sounds reasonable. Happy to try it! However, not sure the implementation is quite right... I remember spending two hours reading before, and got very conflicting info which of the following is ideal:
I'm really hazy, but based on my reading it looks like we could get away with |
I see! It sounds like just However, I believe the problem I've personally run into was From the answer to the link in the second bullet point of your answer:
Anyways, I think we cannot know this for sure unless we try it, so I guess we can close this PR and resurrect it using what we've learnt in case someone runs into issues in the future? |
@trejjam Just to clarify my previous message, if you still have that Windows dev environment around and want to try to validate what we think we have learnt and update this PR, we are still very happy to take it :) But if you're no longer interested (which would also be understandable), then I think we can close this and tackle it in the future when/if some other Windows developer runs into issues. |
The important part of the PR is Sure if you dislike it, just close it. I am not a huge contributor, I do not work with this code base enough |
This solves this kind of issues: |
I was curious so I just did some testing on Windows. And I think @jeffwidman's suggestion fixes the problem. This is what I did:
|
67b5a00
to
bc544c3
Compare
Thanks for testing, what is conclusion? Use only |
I think the following
That way we don't need to keep a explicit list of file extensions that's likely to get out of date. |
bc544c3
to
59a827c
Compare
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.
Looks great! Thank you!
7c55f2f
to
3d7707e
Compare
Add `.gitattributes` with enforced LF so line endings is consistent across systems. We went back and forth on how to implement this, see the pull request thread for detailed discussion, it's complicated.
No description provided.