Skip to main content

summarize_status

Function summarize_status 

Source
pub fn summarize_status(entries: &[Entry]) -> Counts
Expand description

Folds entries into header counts.

Staged and unstaged are counted separately because they answer different questions: “what is in the commit I am about to make” and “what have I not staged yet”. A file changed in both appears in both counts, which is correct — collapsing them is how a commit silently includes edits the user did not intend.

An entry code that is not a known state is treated as absent rather than guessed at. A status surface that invents a state from an unrecognised code shows a badge nobody asked for.