gitui-org / gitui-org/gitui

cargo fmt now messes things up on windows

Aperta
#1,936 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
bug dx help wanted windows
Lingua principale
Rust
Stelle
22.5k
Fork
774
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Apri rustfmt.toml e controlla l’impostazione newline_style. Esegui cargo fmt -- --check su un checkout Windows appena creato con terminatori di riga CRLF. Il lavoro è completato quando il checkout non segnala più ogni file Rust come formattato in modo errato, mentre i controlli di formattazione continuano a funzionare altrove.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, rust
Ambito
build-system, tooling
Tipo di issue
Bug
Difficoltà
1/5
Tempo stimato
Meno di un'ora
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
50/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.