gitui-org / gitui-org/gitui

After staging, next unstaged change is janky

Aperta
#2,748 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
feature-request good first issue
Lingua principale
Rust
Stelle
22.5k
Fork
773
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

The logic that chooses the next unstaged change after staging a change is kind of janky and breaks my flow. I'll call this a bug, call it what you want. I _believe_ the logic is basically nothing. It just tries to keep the vertical _visual_ position in the tree of unstaged changes. Since that is a _tree_ though, it feels weird. Everything is fine if you have a flat list of files, but I usually don't.

Here's the set up:
```
mkdir -p /tmp/treebug
cd /tmp/treebug
git init

echo hunk > f
mkdir g
echo hunk > g/g
echo hunk > g/h
echo hunk > i
echo hunk > j
```
Then enter `gitui`...

Image

## Moving into directories

Ok, let's stage `f`.

Image

Hm, I did not move to the next file. Instead, I moved to the directory g. So just pressing enter repeatedly will not stage file by file, but sometimes stage directories. I don't like this, but whatever. The big issue arises when I am staging from the diff view. This is my initial diff view:

Image

Now, when I stage this hunk, my next screen is the following:

Image

I am seeing the diff of nothing, and I can't do anything in this view. I am forced to return to the tree and navigate to the next file. So staging hunk-by-hunk by repeatedly pressing enter does not work either.

## Moving out of directories

Okay, `f` has been staged. We navigated to the next file manually:

Image

Let's stage `g`:

Image

Good, let's stage `h`:

Image

We just skipped `i`. That is frustrating. Again, in the file tree view, I can correct this. In the diff view, I cannot.

## The fix

Not sure, one would have to experiment. Maybe this would already work:

- After staging a _file_, move to the next _file_.
- After staging a _directory_, keep the vertical position in the GUI.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il comportamento in gitui usando la configurazione /tmp/treebug e le viste dell’albero dei file e delle differenze descritte sopra. Traccia come viene selezionata la modifica successiva non in staging dopo aver messo in staging un file, una directory o un hunk. Il lavoro è completato quando lo staging ripetuto avanza al file successivo e non mostra un diff vuoto né salta dei file.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.