#[non_exhaustive]pub enum WorktreeError {
Show 21 variants
BareRepository,
NotRegistered {
path: PathBuf,
},
MainWorktree {
operation: WorktreeOperation,
},
Locked {
reason: Option<String>,
},
AlreadyLocked {
reason: Option<String>,
},
NotLocked,
HasLocalChanges,
HasSubmodules,
PathRegistered {
path: PathBuf,
},
PathRegisteredMissing {
path: PathBuf,
},
PathExists {
path: PathBuf,
},
PathExistsNotDirectory {
path: PathBuf,
},
NotADirectory {
path: PathBuf,
},
PathNotFound {
path: PathBuf,
},
NoFileName {
path: PathBuf,
},
InvalidAdminDir {
path: PathBuf,
},
BranchTipMismatch {
branch: String,
},
DotGitIsDirectory {
path: PathBuf,
},
BrokenGitFile {
path: PathBuf,
},
LockHeld {
path: PathBuf,
},
NonUtf8SubmodulePath {
path: Vec<u8>,
},
}Expand description
Linked worktree failures, wrapped by Error::Worktree.
Branch problems met while adding a worktree (invalid, missing or existing branch names)
are reported as BranchError instead, and a
branch held by another worktree as
Error::BranchCheckedOutInWorktree.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BareRepository
Linked worktrees cannot be added to a bare repository.
NotRegistered
No registered worktree has path as its working tree root.
MainWorktree
The operation only applies to linked worktrees.
Fields
operation: WorktreeOperationOperation that was refused.
Locked
The worktree is locked and the caller did not force the operation.
AlreadyLocked
Lock was requested for a worktree that is already locked.
NotLocked
Unlock was requested for a worktree that is not locked.
HasLocalChanges
Remove without force found staged, unstaged, conflicted or untracked changes.
HasSubmodules
Move found populated submodules inside the worktree.
PathRegistered
The path is registered to a worktree whose directory still exists.
PathRegisteredMissing
The path is registered to a worktree whose directory is missing, and add was not forced.
PathExists
The target directory exists and is not empty (add) or exists at all (move).
PathExistsNotDirectory
The add target exists and is a file or other non-directory.
NotADirectory
A path that must be a directory (repair target, move destination parent) is not one.
PathNotFound
A repair target does not exist.
NoFileName
The path has no final component to name the worktree after (for example /).
InvalidAdminDir
A worktree admin directory has no parent directory.
BranchTipMismatch
An existing branch used for the worktree HEAD does not point at the start commit.
DotGitIsDirectory
Repair expected a .git gitfile but found a directory.
BrokenGitFile
Repair could not map a worktree’s .git gitfile to a registered admin directory.
LockHeld
Another process holds the lock file guarding a worktree link file.
NonUtf8SubmodulePath
A gitlink entry in the worktree index has a path that is not valid UTF-8.
Trait Implementations§
Source§impl Clone for WorktreeError
impl Clone for WorktreeError
Source§impl Debug for WorktreeError
impl Debug for WorktreeError
Source§impl Display for WorktreeError
impl Display for WorktreeError
impl Eq 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()