#[non_exhaustive]pub enum WorktreeError {
Show 43 variants
Linked(LinkedWorktreeError),
PathIo(PathIoError),
FileChanged {
path: String,
},
Path {
detail: String,
},
NonUtf8Path {
path: String,
},
InvalidPath {
path: String,
},
InvalidPathComponent {
path: String,
reason: PathComponentError,
},
OutsideRepo(PathOutsideRepoError),
PathspecFromFile(PathspecFromFileParseError),
InvalidAttrPathspec {
spec: String,
reason: AttrPathspecError,
},
PathspecNoMatch {
spec: String,
},
PathspecBeyondSymlink {
spec: String,
},
PathspecIgnored {
paths: Vec<String>,
},
RestoreConflictWithStaged,
RestoreConflictWithSource,
RestoreConflictMissingTheirs {
path: String,
},
RestoreConflictMissingOurs {
path: String,
},
RestoreConflictNotUnmerged {
path: String,
},
RestorePathUnmerged {
paths: Vec<String>,
},
EmbeddedRepoWithoutCommit {
path: String,
},
RemoveBlocked {
paths: Vec<BlockedRemoval>,
},
NotRemovingRecursively {
path: String,
},
RemovePathsRequired,
RemoveContainsCurrentDirectory {
path: String,
},
RestorePathsRequired,
RestoreStageWithRemerge,
RequiresWorkTree,
MoveSourceNotTracked {
src: String,
},
MoveDestinationExists {
src: String,
destination: String,
},
MoveDestinationNotDirectory {
destination: String,
},
MoveIntoSubdirectory {
src: String,
destination: String,
},
MoveIntoSelf {
src: String,
destination: String,
},
MoveNothingToMove {
src: String,
},
MoveDuplicateDestination {
destination: String,
},
MoveBadSource {
src: String,
destination: String,
},
MoveMissingIndexEntry {
path: String,
},
WouldOverwrite {
reason: OverwriteReason,
paths: Vec<String>,
message: String,
},
DirtyWorktree {
operation: WorktreeOperation,
paths: Vec<String>,
},
CheckoutRollbackIncomplete {
source: ErrorSummary,
unrestored: Vec<String>,
},
MoveRollbackIncomplete {
source: ErrorSummary,
unreversed: usize,
backup_restore: Option<ErrorSummary>,
},
UnmergedConflictMarkers {
paths: Vec<String>,
},
Filter(FilterError),
Submodule(SubmoduleError),
}Expand description
Worktree-area failure (checkout, status, add/rm/mv/restore/clean, pathspec, filters, linked worktrees).
Surfaced on the umbrella as Error::Worktree.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Linked(LinkedWorktreeError)
Linked worktree registry add/remove/move/lock/repair failure.
PathIo(PathIoError)
Filesystem I/O on a repository-relative worktree path.
FileChanged
A worktree file changed while it was being hashed and stored.
Path
General path resolution failure (invalid UTF-8, out-of-bounds, etc.).
NonUtf8Path
A path that must be UTF-8 for this operation is not.
InvalidPath
A path string failed validation (legacy invalid-path checks).
InvalidPathComponent
A repository-relative path failed component validation.
Fields
reason: PathComponentErrorWhich component rule failed.
OutsideRepo(PathOutsideRepoError)
Path resolves outside the repository.
PathspecFromFile(PathspecFromFileParseError)
--pathspec-from-file parse failure.
InvalidAttrPathspec
Malformed :(attr:...) pathspec magic.
Fields
reason: AttrPathspecErrorWhat is wrong with its attr clause.
PathspecNoMatch
Pathspec matched no tracked or indexed file.
PathspecBeyondSymlink
Literal pathspec crosses a symlink directory component.
PathspecIgnored
Explicit pathspecs name ignored paths.
RestoreConflictWithStaged
Restore conflict options combined with --staged.
RestoreConflictWithSource
Restore conflict options combined with --source.
RestoreConflictMissingTheirs
Missing “theirs” stage for a conflict restore path.
RestoreConflictMissingOurs
Missing “ours” stage for a conflict restore path.
RestoreConflictNotUnmerged
Path is not unmerged when remerge was requested.
RestorePathUnmerged
Worktree restore requested for paths that still have conflict stages.
Fields
EmbeddedRepoWithoutCommit
Nested .git checkout has no commit on its current branch.
RemoveBlocked
Remove refused paths with unsaved content without --force.
Fields
paths: Vec<BlockedRemoval>Each refused path with the reason it was refused.
NotRemovingRecursively
Directory pathspec without -r on remove.
RemovePathsRequired
Remove called with no pathspecs.
RemoveContainsCurrentDirectory
Clean refused to remove a directory that contains the current working directory.
RestorePathsRequired
Restore called with no pathspecs.
RestoreStageWithRemerge
Restore was asked both to pick a conflict side and to rebuild conflict markers.
RequiresWorkTree
Operation requires a checked-out work tree.
MoveSourceNotTracked
Move source is not tracked.
MoveDestinationExists
Move destination exists without --force.
MoveDestinationNotDirectory
Trailing slash named a destination that is not a directory.
MoveIntoSubdirectory
Destination lies under the source directory.
MoveIntoSelf
Source and destination are the same path.
MoveNothingToMove
Source has no index entries to move.
MoveDuplicateDestination
Multiple sources would move to the same destination.
MoveBadSource
Move source path is missing or not a file, directory, or symlink.
MoveMissingIndexEntry
Internal invariant: missing index entry during a move.
WouldOverwrite
Checkout or switch would overwrite local or untracked content.
Fields
reason: OverwriteReasonWhether tracked local edits or untracked paths block the operation.
message: StringHuman-readable summary (depends on OverwriteReason).
DirtyWorktree
Staged or unstaged changes block an operation that needs a clean worktree.
Fields
operation: WorktreeOperationThe operation that was refused.
CheckoutRollbackIncomplete
A checkout failed or was cancelled before it finished, and putting the work tree back failed for some paths.
Refs and the index are unchanged, as after any failed checkout; only unrestored
differ from the index. Error::is_cancelled reports whether source was a
cancellation.
Fields
source: ErrorSummaryWhy the checkout stopped.
MoveRollbackIncomplete
A move failed, and putting the work tree back failed too.
The index is unchanged; renames that could not be reversed and forced-destination backups that could not be restored are left as they are on disk.
Fields
source: ErrorSummaryWhy the move stopped.
backup_restore: Option<ErrorSummary>Why restoring the destinations a forced move replaced failed, when it did.
UnmergedConflictMarkers
Staging refused paths that still contain conflict markers.
Filter(FilterError)
Clean/smudge filter or EOL conversion failure.
Submodule(SubmoduleError)
Submodule layout or state failure during worktree operations.
Implementations§
Source§impl WorktreeError
impl WorktreeError
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether this failure records a cancellation (a checkout whose rollback was incomplete after it was cancelled).
Sourcepub fn kind_name(&self) -> &'static str
pub fn kind_name(&self) -> &'static str
Stable snake_case slug for this failure (matches former Error::kind_name values).
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
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()