Skip to main content

get_worktree_status

Function get_worktree_status 

Source
pub fn get_worktree_status(
    path: &Path,
    repo: &Path,
    branch: Option<&str>,
    pr_cache: &PrCache,
) -> String
Expand description

Determine the status of a worktree.

Status priority: stale > busy > active > merged > pr-open > modified > clean

Merge detection strategy:

  1. Cached gh pr list (primary) — works with all merge strategies (merge commit, squash merge, rebase merge) because GitHub tracks PR state independently of commit SHAs. One gh call per repo, cached 60 s.
  2. git branch --merged (fallback) — only works when commit SHAs are preserved (merge commit strategy). Used when gh is not available.

See pr_cache::PrCache for the batched fetch and TTL details.