Resolve a user-facing ref name to a concrete commit SHA the worktree/scan commands
accept. A clone only materialises a local branch for the repository’s default branch;
every other branch exists solely as a remote-tracking ref (refs/remotes/origin/<name>).
Ref listing strips the origin/ prefix for display, so a bare branch name like “test”
won’t resolve directly — we fall back to the remote-tracking form. Tags and raw SHAs
resolve on the first candidate. Peeling with ^{commit} also dereferences annotated tags.