fn canonical_worktree_root(root: &Path) -> PathBufExpand description
For a linked worktree, the main checkout that owns it; otherwise root
(the CLI’s ke/Ht). Anything that doesn’t check out — a .git file
that isn’t gitdir:, a missing commondir, a worktree whose gitdir
doesn’t point back — leaves root as it is, as the CLI does.