pub enum WorktreeError {
NoParent(String),
GitSpawn(String),
RemoveFailed(String),
CreateFailed(String),
OutsideWorktreesRoot {
path: String,
root: String,
},
NotAPlainDirectory(String),
StillRegistered(String),
ForeignLeftover {
path: String,
detail: String,
},
RegistrationUnusable {
path: String,
detail: String,
},
LeftoverUndeletable {
path: String,
error: String,
},
}Expand description
Errors from remove_worktree.
Variants§
NoParent(String)
The worktree path has no parent directory, so there is no
in-repo location to run git worktree remove from.
GitSpawn(String)
git worktree remove could not be spawned at all.
RemoveFailed(String)
git worktree remove ran but exited non-zero (e.g. a dirty
worktree without --force, or a transient git error). Carries
git’s stderr.
CreateFailed(String)
git worktree add ran but exited non-zero. Carries git’s stderr.
OutsideWorktreesRoot
remove_orphaned_worktree_dir was handed a path that is not a
direct child of the repo’s .claude/worktrees root.
NotAPlainDirectory(String)
remove_orphaned_worktree_dir was handed something that is not
a plain directory (a file, a symlink, a missing path), so there
is nothing safe to delete.
StillRegistered(String)
git still lists the path as a worktree, live or by the stale path a repo move leaves, so it is not a leftover: git may be holding uncommitted work in it. Also returned when the registration cannot be read - refusing is the safe direction.
ForeignLeftover
remove_orphaned_worktree_dir was handed a directory whose
.git entry says it belongs to something else - a directory (a
checkout of its own, never a worktree tail), a link naming a live
foreign repo, or a stale link with no removal this repo recorded.
Not this repo’s leftover, so not this repo’s to delete.
RegistrationUnusable
The registration git lists at the worktree path cannot be reused:
its gitdir link names a path the repo has left and git worktree repair could not rewrite it, or it carries a live foreign link
that repair would adopt. Either way the worktree is not this
spawn’s to use.
LeftoverUndeletable
The leftover directory itself could not be deleted from disk.
Trait Implementations§
Source§impl Debug for WorktreeError
impl Debug for WorktreeError
Source§impl Display for WorktreeError
impl Display for WorktreeError
Source§impl Error for WorktreeError
impl Error for WorktreeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()