Skip to content

Commit

Permalink
Revert removal of CRLF from Windows bat files (#31398)
Browse files Browse the repository at this point in the history
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.

:warning: **EDIT 2021-08-31**

Commits 85249ca and 13107fa 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 455433f):

```
$ 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: #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
  • Loading branch information
friederbluemle authored and facebook-github-bot committed Sep 10, 2021
1 parent 2a02939 commit fc553ed
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ indent_size = 4

[BUCK]
indent_size = 4

# Windows files
[*.bat]
end_of_line = crlf
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

24 changes: 12 additions & 12 deletions scripts/launchPackager.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
:: Copyright (c) Facebook, Inc. and its affiliates.
::
:: This source code is licensed under the MIT license found in the
:: LICENSE file in the root directory of this source tree.

@echo off
title Metro
call .packager.bat
cd ../../../
node "%~dp0..\cli.js" start
pause
exit
:: Copyright (c) Facebook, Inc. and its affiliates.
::
:: This source code is licensed under the MIT license found in the
:: LICENSE file in the root directory of this source tree.

@echo off
title Metro
call .packager.bat
cd ../../../
node "%~dp0..\cli.js" start
pause
exit
3 changes: 0 additions & 3 deletions template/_editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions template/_gitattributes

This file was deleted.

0 comments on commit fc553ed

Please sign in to comment.