Skip to main content

GitError

Enum GitError 

Source
pub enum GitError {
    NotRepository,
    UnsupportedRepositoryPath,
    InvalidPath(RepoPathError),
    PathEscapesRepository {
        path: String,
    },
    NotAFile {
        path: String,
    },
    EmptyCommitMessage,
    Spawn {
        operation: &'static str,
        source: Error,
    },
    CommandFailed {
        operation: &'static str,
        status: Option<i32>,
        stderr: String,
    },
    Io {
        path: PathBuf,
        source: Error,
    },
    SourceTooLarge {
        bytes: u64,
    },
    UnstableSnapshot,
    Diff(DiffError),
}
Expand description

An error from repository discovery, Git execution, or worktree access.

Variants§

§

NotRepository

The supplied location is not inside a Git worktree.

§

UnsupportedRepositoryPath

Git returned a repository root that cannot be represented as UTF-8.

§

InvalidPath(RepoPathError)

A repository-relative path failed validation.

§

PathEscapesRepository

A validated path resolved outside the repository root.

Fields

§path: String

The rejected path.

§

NotAFile

A file operation unexpectedly targeted a directory.

Fields

§path: String

The rejected path.

§

EmptyCommitMessage

A commit message was empty or only whitespace.

§

Spawn

The Git process could not be started or awaited.

Fields

§operation: &'static str

A non-sensitive operation label.

§source: Error

The subprocess I/O error.

§

CommandFailed

Git exited unsuccessfully.

stderr is retained for diagnostics, but omitted from Display to avoid leaking file contents or other sensitive command output.

Fields

§operation: &'static str

A non-sensitive operation label.

§status: Option<i32>

The process exit code, when one was available.

§stderr: String

Git’s standard error bytes, decoded lossily.

§

Io

A filesystem operation failed.

Fields

§path: PathBuf

The affected host path.

§source: Error

The filesystem error.

§

SourceTooLarge

A source version exceeded the per-file capture limit.

Fields

§bytes: u64
§

UnstableSnapshot

Repository metadata or worktree content changed during capture.

§

Diff(DiffError)

Core diff normalization failed.

Trait Implementations§

Source§

impl Debug for GitError

Source§

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

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

impl Display for GitError

Source§

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

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

impl Error for GitError

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<DiffError> for GitError

Source§

fn from(source: DiffError) -> Self

Converts to this type from the input type.
Source§

impl From<RepoPathError> for GitError

Source§

fn from(source: RepoPathError) -> Self

Converts to this type from the input type.

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> 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> 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.