Skip to main content

resolve_target_strict

Function resolve_target_strict 

Source
pub fn resolve_target_strict(
    repo_root: &Path,
    target: &str,
) -> Result<StrictTarget>
Expand description

Strict target resolution: exact worktree name → exact branch name → exact path.

Unlike resolve_worktree_target, this function performs no fuzzy matching and no metadata look-ups. It calls git::parse_worktrees once and applies three ordered exact-match rules:

  1. Worktree name — basename of the worktree directory equals target.
  2. Branch name — short branch name (after stripping refs/heads/) equals target.
  3. Absolute path — the worktree path equals target.

Returns CwError::WorktreeNotFound when no worktree matches.