Skip to main content

current_stack

Function current_stack 

Source
pub fn current_stack(
    repo: &Repository,
    head_branch: &str,
    model: StackModel,
) -> Result<Option<Stack>>
Expand description

Return the stack for the worktree whose HEAD is head_branch, or None if the branch is not part of a tracked stack under model.

The returned Stack includes all branches reachable from the same stack root, not just the ancestors of head_branch, so branching stacks are fully represented.

Under StackModel::Mixed, consults StackModel::providers in order and returns the first Some: the primary provider’s row for head_branch if it has one, else the secondary’s. An error from either provider propagates immediately rather than being swallowed to reach the fallback — a corrupt store is a real failure, not “no row here.”