Skip to main content

resolve_action

Function resolve_action 

Source
pub fn resolve_action(
    repo: &Repository,
    name: &str,
    model: StackModel,
) -> Resolution
Expand description

Resolve the action for workon <name> under the given stack model.

Implements the four-rule cascade from ADR-024.

§Rule summary

  1. T has its own worktree → Navigate. git’s lock makes this correctly first.
  2. Current worktree’s branch shares T’s stack → Checkout in current worktree. (PR-2)
  3. Deepest non-trunk ancestor of T with a worktree → Checkout there. (PR-2)
  4. Branch exists with no worktree → Materialize; metadata without a ref → DeletedNode; nothing matches → NotFound.

Under StackModel::None rules 2–3 are skipped and only rule 1 / rule 4 fire.