gitui-org/gitui

cargo fmt now messes things up on windows

开放

#1,936 创建于 2023年10月24日

 (0 条评论) (1 个反应) (0 位负责人)Rust (721 个派生)batch import
bugdxhelp wantedwindows

仓库指标

星标
 (21,937 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南