Skip to main content

classify

Function classify 

Source
pub fn classify(
    worktree: &Worktree,
    branch: Option<&Branch>,
    layout: &Layout,
    seats: &[&Utf8Path],
    trunk: &str,
    dirty: bool,
) -> WtClass
Expand description

Classify one worktree for the prune report.

The guards run in order and the first one holds; the order is load-bearing — a missing directory takes no status call and is commonly also detached, so the stale arm precedes the detached one by construction, and a lock is kept unconditionally, missing directory included. The caller applies this within the reportable set (stale records and gone-upstream worktrees); the main-worktree and live-upstream arms stay as belt-and-braces for a caller that hands it anything else.

seats are the paths whose worktrees are in use — the caller’s own seat and the target’s current worktree, both, independently. dirty is the handler’s git status --porcelain probe, run only for a worktree whose directory exists; untracked files count.