Skip to content
  • Frieder Bluemle's avatar
    Revert removal of CRLF from Windows bat files (#31398) · fc553ed8
    Frieder Bluemle authored
    Summary:
    This reverts https://github.com/facebook/react-native/issues/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 https://github.com/facebook/react-native/issues/29792 in August 2020.
    
     **EDIT 2021-08-31**
    
    Commits 85249caf and 13107fa3 accidentally converted the gradlew.bat files to LF again, resulting in modified files to appear in the working directory:
    
    ```
    $ git status -s
     M gradlew.bat
     M packages/react-native-codegen/android/gradlew.bat
     M template/android/gradlew.bat
    ```
    
    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 455433f4):
    
    ```
    $ rm gradlew.bat
    $ git status -s
     D gradlew.bat               # Git shows the file as (D)eleted, as expected
    $ git checkout gradlew.bat   # This should restore the file
    $ git status -s
     M gradlew.bat               # The file still shows up, now as (M)odified with all line endings changed
    ```
    
    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
    
    Pull Request resolved: https://github.com/facebook/react-native/pull/31398
    
    Test Plan: Verify files are stored correctly in the repository (e.g. using the `file` command).
    
    Reviewed By: yungsters
    
    Differential Revision: D30839864
    
    Pulled By: cortinico
    
    fbshipit-source-id: dfc53e8c5d9276d2f9bfd4d4a4e6b44c3143a164
    fc553ed8