pub async fn fold_unreadable(
runs: &Path,
worktrees_root: &Path,
id: &str,
) -> Result<Vec<String>>Expand description
Remove a run that cannot be read: its state directory under runs and its
worktree directory under worktrees_root.
The state file is the only record of a run’s repository and branches, so a
run this unreadable is discarded at the filesystem level - there is no
candidate list to fold first. The worktrees live under
crate::run::default_worktree_root unless the run’s config relocated
them, which an unreadable run cannot tell us; the default location is
removed, and anything the run placed elsewhere is a leftover for whoever
knows where it went.
Deleting a worktree directory by hand leaves its registration in git, and a
registered path cannot be re-worktree add-ed until it is pruned - so every
worktree is unregistered from its repository first, best-effort, via the
gitdir: link git keeps inside the directory.