-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Revert removal of CRLF from Windows bat files #31398
Conversation
Base commit: 455433f |
Base commit: 455433f |
870b308
to
f25b149
Compare
Thanks for your PR @friederbluemle Those files have been generated automatically by Gradle with the command:
I'm unsure if removing I'm wondering if we would have to manually edit this |
… all future (facebook#31128)" This reverts commit 7384471.
f25b149
to
d56cb11
Compare
Thanks for the quick reply @cortinico! The command you posted is correct. There should be no need to manually edit the Gradle Wrapper scripts. Like you said, Gradle will automatically generate the files with the correct line endings. Can you test the following real quick: On a clean
|
Just tested and as you mentioned, the last I believe that part of the problem is caused by the fact that internally we use mercurial instead of git and phabricator is exporting the git commits to Github. I'm fine merging your change, but does this mean we would have to do the same whenever we touch the |
@cortinico has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Hey @friederbluemle Thanks for your PR. I've done a couple of tests and we should be fine merging this 👍 |
Thanks @cortinico 👍
I think Mercurial does not read a .gitattributes files, so there should be no issue one way or the other.
As you've mentioned previously, |
cc @pvinis if there are any concerns? |
seems like we are just "fixing" each other's changes. I am on holidays until end of next week. I could check after. If you want to emrge before, I trust you all. |
No rush here.. We can wait for @pvinis to be back from holidays if there are additional questions etc. 👍 |
@cortinico merged this pull request in fc553ed. |
Hey @pvinis @friederbluemle apologize for the confusion. The diff was merged overnight as it was approved internally. I haven't seen your message early enough to stop the pre-approval @friederbluemle I believe we can keep it merged as it fixes the local environment for now (e.g. see #32160) but I'm happy to keep on the discussion and find a definitive solution for this 👍 |
FYI @yungsters just merged #32178 that updates the
True, but we use a bot to export from mercurial to git and I believe that bot is having problems handling whitespace chars. |
I know its late, but only now I moved a project to 68. Removing the editorconfig file and instruction seems unnecessary. Say the files are perfectly set in the repo and on everyones inited project, great. Now imagine i need to do an edit on the .bat file, on my mac machine. Maybe it's because of an upgrade, maybe I want to just fix a typo, or anything else in that .bat file. Now I save, and the file and diff is all messed up, because im on a mac. the editorconfig will make sure that the line endings on these files stay the same. gitattrs, i guess we can remove. editorconfig is needed. What do you think? |
Hi @pvinis - Good question. What I don't fully understand - please explain more - why would saving a file have the side effect of converting all line endings in that file? Which editor are you using? I just did a quick test in a RN 68 repo, editing gradlew.bat using Vim, WebStorm, and VS Code. The project did not have an editorconfig, I was testing on macOS as well, and non of the line endings were changed. |
mostly vscode. there's a lot of times/tools/editors that save and "make sure" the endings are right for the os you are in. also, if I have an editorconfig in my home dir, then that will be applied, and if the config is for Mac by default, it will mess up the bat files. it can be fixed by fixing the home config to include bat, but it's just safer. anyway, I see a lot of resistance, and I have it for my projects, so I don't mind it. I'm only trying to make it less error prone for others 🤷♂️. |
You should not need to edit that .bat file. That is a gradle generated file and should not be touched. The output of the Your argument could potentially hold if you might have other |
I don't believe in "don't touch this file", and if an upgrade has a small change, I usually do it myself, rather than copy paste the whole file anyway, but I get your point. I don't agree, but I get it. |
This specific issue is related to the Gradle Wrapper which must be updated usign this command: https://docs.gradle.org/7.4.2/release-notes.html#upgrade-instructions |
Summary
This reverts #31128 - For the reasons stated in the thread. Files should have the correct endings in the repo (i.e. Windows .bat CRLF). There is no reason to perform additional conversion with attributes and/or an editorconfig. It was originally fixed in #29792 in August 2020.
Commits 85249ca and 13107fa accidentally converted the gradlew.bat files to LF again, resulting in modified files to appear in the working directory:
The reasons why this is happening are explained in detail in the two PRs linked above.
I've added an additional (new) commit to the PR head branch to fix the line endings in all three
gradlew.bat
files of the repo and rebased it. It should be ready for merge.CC @cortinico
EDIT 2021-09-02
The additional commit was removed again, but the original one remains.
To test the scenario locally run the following commands on a clean
main
branch (currently 455433f):The modified file will remain in the working directory until they are committed, or a different branch is force checked out.
gradlew.bat
files are generated automatically by Gradle (with the correct line endings in the first place). There is no need to special case them and perform line ending conversion using Git and/or editorconfig.Changelog
[General] [Fixed] - Line endings in Windows files, Git/EditorConfig related conversions
Test Plan
Verify files are stored correctly in the repository (e.g. using the
file
command).