gitui icon indicating copy to clipboard operation
gitui copied to clipboard

cargo fmt now messes things up on windows

Open pm100 opened this issue 1 year ago • 0 comments

rustfmt.toml now has

newline_style ="Unix"

this really messes things up on windows since running cargo fmt now converts all line endings to unix.

git (and gitui) report this as a massive number of files being changed, which is hard to work thru.

Leaving it as Auto works fine on other projects and used to work for gitui when I first worked on it.

git (and gitui and github) convert the line endings correctly when copying down to windows (lf-> crlf) and when uploading back to github (crlf -> lf), this is done by leaving the gitconfig crlf setting as auto. (which is the default). So there is no need for this rustfmt setting, the line endings will be lf in github anyway regardless .

here is newly cloned repo running fmt check

PS C:\work\newgit2\gitui> cargo fmt -- --check
Incorrect newline style in \\?\C:\work\newgit2\gitui\asyncgit\src\asyncjob\mod.rs
Incorrect newline style in \\?\C:\work\newgit2\gitui\asyncgit\src\blame.rs
Incorrect newline style in \\?\C:\work\newgit2\gitui\asyncgit\src\branches.rs
Incorrect newline style in \\?\C:\work\newgit2\gitui\asyncgit\src\cached\branchname.rs
Incorrect newline style in \\?\C:\work\newgit2\gitui\asyncgit\src\cached\mod.rs
Incorrect newline style in \\?\C:\work\newgit2\gitui\asyncgit\src\commit_files.rs
...

it complains about every file because the clone down to windows converted all line endings to crlf

What I have to do at the moment is edit the rustfmt file to Auto.

Took me a while to work out why gitui / git suddenly starting saying all files had been changed

pm100 avatar Oct 24 '23 03:10 pm100