fix(diff): a read that failed must not overwrite the sidebar's counts

The overlay says "could not read the diff" in words, and then published
the failed read's zero totals over the +N -N the row already had right.
This commit is contained in:
l0ng-ai
2026-08-09 12:02:03 +07:00
parent c625ccbe38
commit de2e622be5
+6 -1
View File
@@ -185,7 +185,12 @@ impl Tty7App {
// +N N asks, and it is the one the reader is looking at. Hand the
// numbers back before anything renders, or the row can disagree with
// the overlay it just opened.
let mut landed = if let Some(snap) = snap.as_ref() {
//
// A read that failed is not an answer at all: its totals are whatever
// got parsed before git gave up, usually zero. Publishing those wipes
// the counts the sidebar already had right — the overlay says so in
// words a few lines below, and the row would silently disagree.
let mut landed = if let Some(snap) = snap.as_ref().filter(|s| !s.read_failed) {
let (added, removed) = snap.totals();
let root = snap.root.clone();
cx.default_global::<crate::terminal::git_status::GitStatusCache>();