Skip to content
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

Formatter converts CRLF endings to LF #312

Open
lukebakken opened this issue Jun 14, 2022 · 0 comments
Open

Formatter converts CRLF endings to LF #312

lukebakken opened this issue Jun 14, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@lukebakken
Copy link

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 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:

repro.ps1.txt

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:

.\repro.ps1 | Tee-Object -Path $HOME\rebar3-debug.log.txt

rebar3-debug.log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants