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

On Windows, moon fmt and moon info generate different end-of-line #530

Open
1 task
inkydragon opened this issue Dec 19, 2024 · 1 comment
Open
1 task
Assignees

Comments

@inkydragon
Copy link

Bug Report

Environment

OS

Operating System: Windows 11 24H2

MoonBit CLI Tools Version

moon version --all
moon 0.1.20241218 (5a38a2f 2024-12-18) ~\.moon\bin\moon.exe
moonc v0.1.20241218+f4a066f5f ~\.moon\bin\moonc.exe
moonrun 0.1.20241218 (5a38a2f 2024-12-18) ~\.moon\bin\moonrun.exe

And I'm using dev version of core 1fae2a3

Steps to Reproduce

Using Pwsh, clone moonbitlang/core

PS T:\> # Checkout with LF
PS T:\> git config --global core.autocrlf false
PS T:\> git config --global core.autocrlf
false
PS T:\> git config --global core.eol
PS T:\> git clone https://github.com/moonbitlang/core.git

Run moon fmt

PS T:\> cd .\core\
PS T:\core> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
PS T:\core> git diff
PS T:\core> moon fmt
PS T:\core> git diff
PS T:\core> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

Run moon info

PS T:\core> moon info
Finished. moon: ran 90 tasks, now up to date
PS T:\core> git diff
diff --git a/array/array.mbti b/array/array.mbti
index 85a269a..1efce1a 100644
--- a/array/array.mbti
+++ b/array/array.mbti
@@ -1,77 +1,77 @@
...
...

PS T:\core> git config core.autocrlf input
PS T:\core> git diff
warning: in the working copy of 'array/array.mbti', CRLF will be replaced by LF the next time Git touches it
warning: in the working copy of 'bool/bool.mbti', CRLF will be replaced by LF the next time Git touches it
warning: in the working copy of 'buffer/buffer.mbti', CRLF will be replaced by LF the next time Git touches it
warning: in the working copy of 'builtin/builtin.mbti', CRLF will be replaced by LF the next time Git touches it
warning: in the working copy of 'byte/byte.mbti', CRLF will be replaced by LF the next time Git touches it
warning: in the working copy of 'bytes/bytes.mbti', CRLF will be replaced by LF the next time Git touches it
warning: in the working copy of 'char/char.mbti', CRLF will be replaced by LF the next time Git touches it
Another way of reproducing:
PS T:\> # Checkout with CRLF
PS T:\> git config --global core.autocrlf true
PS T:\> git clone https://github.com/moonbitlang/core.git core-crlf
Cloning into 'core-crlf'...
remote: Enumerating objects: 14680, done.
remote: Counting objects: 100% (1102/1102), done.
remote: Compressing objects: 100% (318/318), done.
remote: Total 14680 (delta 916), reused 790 (delta 784), pack-reused 13578 (from 4)
Receiving objects: 100% (14680/14680), 4.00 MiB | 2.41 MiB/s, done.
Resolving deltas: 100% (10224/10224), done.
PS T:\> cd .\core-crlf\
PS T:\core-crlf> git diff
PS T:\core-crlf> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

Run moon info

PS T:\core-crlf> moon info
Finished. moon: ran 90 tasks, now up to date
PS T:\core-crlf> git diff
PS T:\core-crlf> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

Run moon fmt

PS T:\core-crlf> moon fmt
PS T:\core-crlf> git diff
warning: in the working copy of 'array/array.mbt', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'array/array_js.mbt', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'array/array_nonjs.mbt', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'array/array_test.mbt', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'array/blit.mbt', LF will be replaced by CRLF the next time Git touches it

Expected Behavior

I would recommend keeping the EOL unchanged, as users may be using platform-specific EOLs, or automatically switching EOLs at check-in, commit, etc. with tools like git.

Actual Behavior

  • moon fmt always generates LF as EOL on Windows.
  • moon info always generate CRLF as EOL on Windows.

Checklist

  • (Optional) My case is minimal enough to be reproducible.
@Young-Flash
Copy link
Collaborator

cc @Yoorkin

@Yoorkin Yoorkin self-assigned this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants