SIGN IN SIGN UP

refactor(worktree): one removal path instead of a pre-check that predicts git

The pre-check existed to keep a marker-less directory away from `git
worktree remove`, but git needs no such help: it validates the `.git`
marker before deleting anything and refuses outright, contents untouched
— measured across all four shapes (registered or not, empty or not).
Asking git first is therefore free, and the fallback it already had
recovers every leftover the pre-check did.

What made that safe to collapse is `remove_dir` being non-recursive: it
can only ever succeed on an empty directory, so a shell holding a file
fails closed whichever call reaches it.

The one thing the pre-check did carry is which failure to report, so that
moves to where it belongs. A checkout git still speaks for keeps git's
reporting; a detached shell has none worth keeping — git's only word about
it names a `.git` the user never heard of, while the removal that failed
was ours. Both directions are pinned, the second by a locked worktree.
X
xintaofei committed
f4988da34f71b20d70ad9a3c10268609f6966c2c
Parent: 3ed2897