gitui-org / gitui-org/gitui

Wrong patch when staged line by line, compared to other alternatives

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

Descrizione

**Describe the bug**
Wrong patch when line by line staging compared to using hunks or lazygit or ``git add -e``.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a empty repo
2. Stage & commit this on a file:
```rs
struct Earth;

impl Earth {
fn new() -> Self {
Self
}
}

struct Mars;

impl Mars {
fn new() -> Self {
Self
}
}
```
3. Update the file with this:
```rs
struct Earth;

impl Earth {
fn new() -> Self {
Self
}
fn into_mars(self) -> Mars {
Mars
}
}

struct Mars;

impl Mars {
fn new() -> Self {
Self
}
fn into_earth(self) -> Earth {
Earth
}
}
```
4. Use gitui to just stage ``into_mars`` and its body
5. Check the resulted patch with ``git diff --staged``

**Expected behavior**
I expect it to match other commands and tools.

**Screenshots**
(source code is different from the example above as I recorded these before creating the issue)
Using gitui: https://asciinema.org/a/dL8rEfpOHRQskpa7wmfVTJDQF
Using lazygit: https://asciinema.org/a/z0iSujDQzZO24wr7qXjKNwTf2

**Context (please complete the following information):**
- OS/Distro + Version: Windows 10 22H2
- GitUI Version: 0.21.0
- Rust version: 1.66.0-nightly

**Additional context**
I don't know if this is actually an issue because I don't know much about git patches; but it looks like it corrupts(?) the patch.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo passo per passo le fasi di staging in gitui 0.21.0 usando l'esempio Earth and Mars, quindi esamina il percorso di staging e confronta il risultato con git diff --staged, git add -e e lazygit. Il lavoro è completato quando la selezione del solo into_mars produce la stessa patch staged valida degli altri strumenti.

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

Valutazione

Stack tecnologico
git, rust
Ambito
cli, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.