Problem
run_git_status in src-tauri/src/git_info.rs:209 now calls compute_diff_stats on every cache miss to populate the lines-changed badge (#559). But by the time we call it (line 257), we already know modified, staged, and untracked from parsing git status --porcelain=v2 --branch. When all three are 0 — i.e. the working tree is clean against HEAD — git diff --numstat HEAD will produce no output and git ls-files --others --exclude-standard will produce no output. We pay for two subprocess spawns + 3s timeout watchdogs for a guaranteed empty result.
In a typical agent workflow, most panes most of the time look at clean repos (between edits, between commits). With the 3-second cache TTL and multiple panes polling, those wasted spawns add up.
Fix
Short-circuit before calling `compute_diff_stats`:
```rust
let (lines_added, lines_removed) = if modified == 0 && staged == 0 && untracked == 0 {
(0, 0)
} else {
compute_diff_stats(path).unwrap_or((0, 0))
};
```
Doesn't affect correctness — a clean tree has no diff to report. Saves two git subprocess spawns + the IO/parse + the timeout-loop bookkeeping per cache miss, per pane, on clean repos.
Files
src-tauri/src/git_info.rs:257
Out of scope
- Pre-computing diff stats from the porcelain output itself. The porcelain doesn't include line counts, so we'd still need the subprocess for non-clean trees.
- Replacing
compute_diff_stats with a libgit2 implementation. Bigger lift; this is the cheap win.
References
Problem
run_git_statusinsrc-tauri/src/git_info.rs:209now callscompute_diff_statson every cache miss to populate the lines-changed badge (#559). But by the time we call it (line 257), we already knowmodified,staged, anduntrackedfrom parsinggit status --porcelain=v2 --branch. When all three are 0 — i.e. the working tree is clean against HEAD —git diff --numstat HEADwill produce no output andgit ls-files --others --exclude-standardwill produce no output. We pay for two subprocess spawns + 3s timeout watchdogs for a guaranteed empty result.In a typical agent workflow, most panes most of the time look at clean repos (between edits, between commits). With the 3-second cache TTL and multiple panes polling, those wasted spawns add up.
Fix
Short-circuit before calling `compute_diff_stats`:
```rust
let (lines_added, lines_removed) = if modified == 0 && staged == 0 && untracked == 0 {
(0, 0)
} else {
compute_diff_stats(path).unwrap_or((0, 0))
};
```
Doesn't affect correctness — a clean tree has no diff to report. Saves two
gitsubprocess spawns + the IO/parse + the timeout-loop bookkeeping per cache miss, per pane, on clean repos.Files
src-tauri/src/git_info.rs:257Out of scope
compute_diff_statswith a libgit2 implementation. Bigger lift; this is the cheap win.References
src-tauri/src/git_info.rs:272-345(compute_diff_stats), commit 726cca4 (Show lines-changed (+N / -M) per pane in the footer #559).