Running rebar3_format on a DOS/Windows text file with CRLF endings will result in LF.
To Reproduce
Run this script on a Windows system with Erlang/OTP and rebar3 installed and in the PATH.
The script clones this repository using core.autocrlf = true, and then runs rebar3 test. This will eventually run the formatter on the files in this project, and you will see that they have been converted to LF endings:
C:\Users\bakkenl\Temp\rebar3_format [main ≡ +0 ~18 -0 !]
> git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: elvis.config
modified: rebar.config
modified: src/formatters/default_formatter.erl
modified: src/formatters/erlfmt_formatter.erl
modified: src/formatters/otp_formatter.erl
modified: src/formatters/sr_formatter.erl
modified: src/rebar3_ast_formatter.erl
modified: src/rebar3_format.app.src
modified: src/rebar3_format.erl
modified: src/rebar3_format_prv.erl
modified: src/rebar3_formatter.erl
modified: test/complete_coverage_SUITE.erl
modified: test/erlfmt.erl
modified: test/erlfmt_formatter_SUITE.erl
modified: test/otp_formatter_SUITE.erl
modified: test/sr_formatter_SUITE.erl
modified: test/steamroller.erl
modified: test/test_app_SUITE.erl
Expected behavior
Line endings should not be modified by rebar3_format.
Rebar3 Log
This was generated by adding $env:DEBUG='1' to repro.ps1 and running:
Describe the bug
Running
rebar3_format
on a DOS/Windows text file with CRLF endings will result in LF.To Reproduce
Run this script on a Windows system with Erlang/OTP and
rebar3
installed and in thePATH
.The script clones this repository using
core.autocrlf = true
, and then runsrebar3 test
. This will eventually run the formatter on the files in this project, and you will see that they have been converted to LF endings:repro.ps1.txt
Expected behavior
Line endings should not be modified by
rebar3_format
.Rebar3 Log
This was generated by adding
$env:DEBUG='1'
torepro.ps1
and running:rebar3-debug.log.txt