Skip to main content

WorktreeError

Enum WorktreeError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BareRepository

Linked worktrees cannot be added to a bare repository.

§

NotRegistered

No registered worktree has path as its working tree root.

Fields

§path: PathBuf

Normalized path that matched no registry entry.

§

MainWorktree

The operation only applies to linked worktrees.

Fields

§operation: WorktreeOperation

Operation that was refused.

§

Locked

The worktree is locked and the caller did not force the operation.

Fields

§reason: Option<String>

Contents of the locked file, when non-empty.

§

AlreadyLocked

Lock was requested for a worktree that is already locked.

Fields

§reason: Option<String>

Contents of the existing locked file, when non-empty.

§

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.

Fields

§path: PathBuf

Registered working tree path.

§

PathRegisteredMissing

The path is registered to a worktree whose directory is missing, and add was not forced.

Fields

§path: PathBuf

Registered working tree path that is missing on disk.

§

PathExists

The target directory exists and is not empty (add) or exists at all (move).

Fields

§path: PathBuf

Occupied path.

§

PathExistsNotDirectory

The add target exists and is a file or other non-directory.

Fields

§path: PathBuf

Occupied path.

§

NotADirectory

A path that must be a directory (repair target, move destination parent) is not one.

Fields

§path: PathBuf

Offending path.

§

PathNotFound

A repair target does not exist.

Fields

§path: PathBuf

Missing path.

§

NoFileName

The path has no final component to name the worktree after (for example /).

Fields

§path: PathBuf

Path without a final component.

§

InvalidAdminDir

A worktree admin directory has no parent directory.

Fields

§path: PathBuf

Admin directory path.

§

BranchTipMismatch

An existing branch used for the worktree HEAD does not point at the start commit.

Fields

§branch: String

Short branch name.

§

DotGitIsDirectory

Repair expected a .git gitfile but found a directory.

Fields

§path: PathBuf

The worktree’s .git path.

§

BrokenGitFile

Repair could not map a worktree’s .git gitfile to a registered admin directory.

Fields

§path: PathBuf

The worktree’s .git path.

§

LockHeld

Another process holds the lock file guarding a worktree link file.

Fields

§path: PathBuf

Lock file path.

§

NonUtf8SubmodulePath

A gitlink entry in the worktree index has a path that is not valid UTF-8.

Fields

§path: Vec<u8>

Raw index path bytes.

Trait Implementations§

Source§

impl Clone for WorktreeError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorktreeError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for WorktreeError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for WorktreeError

Source§

impl Error for WorktreeError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<WorktreeError> for Error

Source§

fn from(source: WorktreeError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for WorktreeError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WorktreeError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.