Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 161 variants NotARepository(String), ForbiddenBareRepository(String), DubiousOwnership(String), UnsupportedRepositoryFormatVersion(u32), UnsupportedRepositoryExtension(String), InvalidRefStorageFormat { value: String, }, InitObjectFormatChange, InitBareWithSeparateGitDir, InvalidObjectId(String), HashCollision { oid: ObjectId, }, ObjectNotFound(String), RevisionNotFound(String), PromisedObjectMissing(ObjectId), CorruptObject(String), PackIndexChecksumMismatch { path: PathBuf, mismatch: TrailerMismatch, }, UnresolvedDeltas { count: u64, }, InvalidObject { kind: ObjectKind, check: FsckError, }, InvalidTreeEntry(TreeEntryError), InvalidSignature(SignatureError), UnexpectedObjectKind { oid: ObjectId, expected: ObjectKind, actual: ObjectKind, }, CommitGraphParentMissing { commit: ObjectId, parent: ObjectId, }, DeltaChainTooDeep { limit: usize, }, UnknownObjectType(String), ObjectHeaderTooLong { oid: String, }, Io(Error), LockHeld { path: PathBuf, holder: Option<LockHolder>, }, Zlib(String), LooseHashMismatch { path: String, real_oid: String, }, LooseObjectWrite { path: String, source: Error, }, WorktreePathIo { path: String, operation: WorktreePathOperation, source: Error, }, GitDirPathIo { path: String, operation: GitDirPathOperation, source: Error, }, ObjectStreamTruncated { expected: u64, actual: u64, }, WorktreeFileChanged { path: String, }, IndexError(String), IndexUnmerged, MaintenanceRunning { holder: GcLockHolder, }, UnmergedConflictMarkers { paths: Vec<String>, }, IndexPathPrefixConflict { directory: PathBuf, file: PathBuf, }, IndexFsmonitorExtensionTruncated, IndexFsmonitorExtensionBadVersion(u32), IndexFsmonitorExtensionEwahInvalid, CacheTreeCorrupt, InvalidRef(String), PackedRefsUnexpectedLine { path: String, line: String, }, PathError(String), PathspecFromFile(PathspecFromFileParseError), InvalidPath(String), InvalidPathComponent { path: String, reason: PathComponentError, }, Config(ConfigError), Branch(BranchError), RefLock(RefLockError), RefStore(RefStoreError), Reftable(ReftableError), Filter(FilterError), Apply(ApplyError), DiffPath(DiffPathError), PathOutsideRepo(PathOutsideRepoError), Signing(String), Auth { url: String, reason: AuthFailure, }, PushOptionsUnsupported, FetchUnshallowNotShallow, FetchShallowUnsupported, FetchDeepenRelativeUnsupported, BundleMissingPrerequisites, ReceivedPackTempMissing { path: PathBuf, }, InvalidAttrPathspec { spec: String, reason: AttrPathspecError, }, PathspecNoMatch { spec: String, }, RestoreConflictWithStaged, RestoreConflictWithSource, RestoreConflictMissingTheirs { path: String, }, RestoreConflictMissingOurs { path: String, }, RestoreConflictNotUnmerged { path: String, }, RestorePathUnmerged { paths: Vec<String>, }, PathspecBeyondSymlink { spec: String, }, PartialCommitDuringMerge, PathspecIgnored { paths: Vec<String>, }, RemoveBlocked { paths: Vec<BlockedRemoval>, }, NotRemovingRecursively(String), RequiresWorkTree, EmptyCommitMessage, RemovePathsRequired, MoveSourceNotTracked { src: String, }, MoveDestinationExists { src: String, 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, }, RemoteUnreadable { url: Option<String>, reason: RemoteUnreadableReason, }, FetchRefspec(FetchRefspecError), FetchNonFastForward { local_ref: String, }, FetchIntoCheckedOutBranch { branch: String, }, WouldOverwrite { reason: OverwriteReason, paths: Vec<String>, message: String, }, DirtyWorktree { operation: WorktreeOperation, paths: Vec<String>, }, InvalidIdentity(CommitIdentityError), Cancelled, Identity(IdentityError), Message(String), NotFastForward, NothingToCommit, NothingStagedToCommit { unstaged: usize, untracked: usize, }, DetachedHead, UnbornHead, InvalidHead, MergeCommit { oid: ObjectId, }, ReplaySourceAtHead, SequencerUnknownCommand { command: String, }, ReplayAbortHeadMoved, ReplayContinueUnmerged, NoReplayInProgress, OperationInProgress(InProgressOperation), BranchCheckedOutInWorktree { branch: String, worktree_path: String, }, BranchNotFound { branch: String, }, BranchListNamesDateSort, CannotDeleteCurrentBranch { branch: String, }, BranchNotMerged { branch: String, }, TagNotFound { tag: String, }, Tag(TagError), Worktree(WorktreeError), CorruptStash(&'static str), StashNotFound { n: usize, }, ReflogUnknownRef { refname: String, }, ReflogInvalidSelector { spec: String, }, ReflogInvalidIndex { spec: String, source: ParseIntError, }, ReflogIndexOutOfRange { refname: String, index: usize, }, StashNoInitialCommit, StashBareRepository, StashIndexConflict, StashOptionConflict(String), HunkSelection(HunkSelectError), StashMissingHead, StashWouldOverwriteLocalChanges { paths: String, }, StashIndexWrite(String), StashSymlinkNotUtf8, StashCouldNotRestoreUntracked { path: String, }, AmendUnborn, NoteAlreadyExists { object: ObjectId, }, InvalidNotesRef(String), NotesRefNotCommit { notes_ref: String, found: ObjectKind, }, NotesObjectKind { oid: ObjectId, expected: ObjectKind, found: ObjectKind, }, NotesMergeBothEmpty { local: String, remote: String, }, NotesMergeInProgress { path: PathBuf, }, Midx(MidxError), RevParse(RevParseError), RevList(RevListError), Hook(HookError), History(HistoryError), UnsupportedObjectStore { operation: &'static str, }, OdbObjectsDirMismatch { builder: PathBuf, repository: PathBuf, }, TreeSha256InvalidHex, TreeSha256InvalidRevision { found: ObjectKind, }, TreeSha256MissingSubmodules(Vec<MissingSubmodule>), TreeSha256RequiresSigning, TagVerifyNotTag { oid: ObjectId, found: ObjectKind, }, TagVerifyMissingObjectHeader, TagVerifyDuplicateTreeSha256Header, TreeSha256Claim(TreeSha256ClaimError), BlameIgnoreRevUnknown { rev: String, }, BlameIgnoreRevsFileOpen { path: String, source: Error, }, BlameIgnoreRevsFileInvalidRev { path: String, rev: String, },
}
Expand description

The top-level error type for all grit-lib operations.

§Examples

use grit_lib::error::Error;

let err = Error::Message("repository not found".into());
assert!(err.to_string().contains("repository not found"));

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

NotARepository(String)

A repository could not be found or is structurally invalid.

§

ForbiddenBareRepository(String)

A bare repository was found but access is forbidden by safe.bareRepository.

§

DubiousOwnership(String)

The repository is owned by a different user (safe.directory).

§

UnsupportedRepositoryFormatVersion(u32)

Repository format version is not supported by this implementation.

§

UnsupportedRepositoryExtension(String)

Repository declares an unsupported extension.

§

InvalidRefStorageFormat

extensions.refStorage names an unsupported backend.

Fields

§value: String

Raw extensions.refStorage value from the repository config.

§

InitObjectFormatChange

crate::repo::Repository::init_with_outcome refused to change object format on reinit.

§

InitBareWithSeparateGitDir

crate::repo::Repository::init_with_outcome with incompatible --bare and separate git dir.

§

InvalidObjectId(String)

A supplied object ID string was not valid hex or the wrong length.

§

HashCollision

SHA-1 object hashing detected a chosen-prefix collision (sha1dc).

Fields

§oid: ObjectId

Plain SHA-1 digest for the colliding input (not safe to use as an object id).

§

ObjectNotFound(String)

The requested object does not exist in the object store.

§

RevisionNotFound(String)

A revision expression (branch, tag, object id, x~n, ORIG_HEAD, …) names nothing in the repository. Holds the expression as the caller wrote it.

§

PromisedObjectMissing(ObjectId)

A partial-clone promisor object is not present locally and no fetcher ran.

§

CorruptObject(String)

An object’s stored data is corrupt or malformed.

§

PackIndexChecksumMismatch

A pack index (.idx) file’s trailing checksum does not match its contents.

Only reported by reads that verify the index trailer, such as crate::pack::read_pack_index; the checksum of the .pack the index describes is checked separately.

Fields

§path: PathBuf

The .idx file that failed verification.

§mismatch: TrailerMismatch

Expected and stored trailer digests.

§

UnresolvedDeltas

Indexing or unpacking a pack left deltas whose bases are neither in the pack nor in the object database: a thin pack without its bases, or a ref-delta cycle.

Fields

§count: u64

Number of deltas left unresolved.

§

InvalidObject

crate::objects::Objects::write refused a payload that git fsck would reject; nothing was written.

Fields

§kind: ObjectKind

Kind the payload was meant to be stored as.

§check: FsckError

The first fsck rule the payload breaks (check.id is Git’s fsck message id).

§

InvalidTreeEntry(TreeEntryError)

§

InvalidSignature(SignatureError)

A crate::ident::Signature cannot be written as an author, committer or tagger line.

§

UnexpectedObjectKind

An object exists but has a different kind than the operation requires, such as a tree or blob where a commit was expected.

Fields

§oid: ObjectId

The object that was read.

§expected: ObjectKind

The kind the operation required.

§actual: ObjectKind

The kind the object actually has.

§

CommitGraphParentMissing

A commit-graph write was given a commit whose parent is neither among the commits being written nor in the base graph layers, so its parent edge cannot be encoded.

Fields

§commit: ObjectId

Commit whose parent list was being encoded.

§parent: ObjectId

Parent that is missing from the graph.

§

DeltaChainTooDeep

In-pack delta resolution exceeded the read-side chain depth limit (guards against cyclic ref-delta chains and unbounded recursion; Git has no read limit).

Fields

§limit: usize

Maximum delta chain depth allowed while reading packed objects.

§

UnknownObjectType(String)

An unsupported or unknown object type was encountered.

§

ObjectHeaderTooLong

Loose object header type field exceeds Git’s 32-byte limit.

Fields

§oid: String

Object id (hex) of the loose object with an oversized header.

§

Io(Error)

An I/O error from the underlying filesystem.

§

LockHeld

A lock file (for example .git/index.lock or refs/heads/main.lock) already exists, so another process is updating the same file or a crashed one left the lock behind.

Operations that return this before changing anything leave the repository untouched. The lock file belongs to whoever created it and is never removed. Retry once the other process finishes, or delete path when no process owns it (a holder with running: false means the lock is stale).

Fields

§path: PathBuf

The lock file that could not be created.

§holder: Option<LockHolder>

Owner recorded in the lock’s pid sidecar (core.lockfilePid), when one was written.

§

Zlib(String)

A zlib compression or decompression failure.

§

LooseHashMismatch

Loose object bytes hash to a different OID than the file path implies (git fsck / read_loose_object).

Fields

§path: String

Repository-relative or filesystem path to the loose object file.

§real_oid: String

Hex object id of the unpacked contents.

§

LooseObjectWrite

A prepared loose object could not be written during parallel index staging.

Fields

§path: String

Index-relative path of the blob being stored.

§source: Error

Underlying filesystem error from the object store.

§

WorktreePathIo

Filesystem I/O failed on a repository-relative worktree path (checkout, staging, diff).

Fields

§path: String

Index- or worktree-relative path grit was operating on.

§operation: WorktreePathOperation

What the operation was trying to do when I/O failed.

§source: Error

Underlying OS error.

§

GitDirPathIo

Filesystem I/O failed on a path under the repository git directory (objects, refs, logs, …).

Fields

§path: String

Display path such as .git/objects or .git/refs/heads/main.

§operation: GitDirPathOperation

What the operation was trying to do when I/O failed.

§source: Error

Underlying OS error.

§

ObjectStreamTruncated

A streamed object write or hash ended before the declared size was read.

Fields

§expected: u64

Payload size the caller declared.

§actual: u64

Bytes the stream delivered before end of file.

§

WorktreeFileChanged

A worktree file hashed earlier in an operation had different content when stored.

Fields

§path: String

Index-relative path of the file.

§

IndexError(String)

The index file is missing, truncated, or has a bad header.

§

IndexUnmerged

Stage-1/2/3 entries are present; a stage-0 tree cannot be built.

§

MaintenanceRunning

Another maintenance run holds the repository’s gc.pid lock (crate::maintenance::GcLock); nothing was changed.

Fields

§holder: GcLockHolder

Process recorded in gc.pid.

§

UnmergedConflictMarkers

Explicit crate::porcelain::add::stage refused paths that still contain conflict markers.

Fields

§paths: Vec<String>

Repository-relative paths that were not staged because markers remain.

§

IndexPathPrefixConflict

A file path is a prefix of another index path at the same tree level.

Fields

§directory: PathBuf

Shorter path (treated as the ambiguous directory prefix).

§file: PathBuf

Longer path that extends the prefix with an additional component.

§

IndexFsmonitorExtensionTruncated

The FSMN index extension ends before its header, token, or EWAH payload.

§

IndexFsmonitorExtensionBadVersion(u32)

The FSMN extension header version is not supported.

§

IndexFsmonitorExtensionEwahInvalid

The EWAH bitmap embedded in FSMN could not be decoded.

§

CacheTreeCorrupt

The cache-tree extension references more entries than the index contains. Git emits this (verbatim, prefixed with error: ) when a tree with duplicate path entries is read into the index (t4058-diff-duplicates).

§

InvalidRef(String)

A reference name or value is invalid.

§

PackedRefsUnexpectedLine

A packed-refs line Git would reject when reading the ref database.

Fields

§path: String

Path to the packed-refs file being read.

§line: String

Offending line contents.

§

PathError(String)

A general path-related error (invalid UTF-8, out-of-bounds, etc.).

§

PathspecFromFile(PathspecFromFileParseError)

--pathspec-from-file parse failure.

§

InvalidPath(String)

A tree/index path component is forbidden (.git, HFS/NTFS aliases, etc.).

§

InvalidPathComponent

A repository-relative path failed crate::path_validate rules while populating the index or checkout.

Fields

§path: String

Full repository-relative path that was rejected.

§reason: PathComponentError

Which component rule failed.

§

Config(ConfigError)

A configuration file parsing or access error.

§

Branch(BranchError)

Branch create, delete, or upstream configuration failure.

§

RefLock(RefLockError)

Reference lock failure while updating refs.

§

RefStore(RefStoreError)

Reference store transaction or iteration failure.

§

Reftable(ReftableError)

Reftable file, stack, or transaction failure.

§

Filter(FilterError)

Filter or EOL conversion failure.

§

Apply(ApplyError)

Patch application failure.

§

DiffPath(DiffPathError)

Diff path selection failure.

§

PathOutsideRepo(PathOutsideRepoError)

Path resolves outside the repository.

§

Signing(String)

A commit/tag signing or signature-verification error.

§

Auth

HTTP authentication failed: the server required credentials (401) and either no credential provider was wired, the provider could not supply a usable username/password, the server demanded an unsupported auth scheme, or the supplied credentials were rejected.

Distinct from Error::Message so embedders can detect an authentication failure (and e.g. fall back to an interactive/subprocess path) rather than string-matching, and so the failure surfaces typed instead of hanging.

Fields

§url: String

Repository URL with credentials redacted and smart-HTTP endpoint suffixes (/info/refs?service=…, /git-upload-pack, /git-receive-pack) removed.

§reason: AuthFailure

What went wrong.

§

PushOptionsUnsupported

A push carried --push-option values but the remote git-receive-pack did not advertise the push-options capability, so the options cannot be transmitted.

Distinct from Error::Message so embedders can detect this specific negotiation failure (and e.g. fall back to a subprocess push) rather than string-matching. The message matches Git’s fatal: the receiving end does not support push options.

§

FetchUnshallowNotShallow

git fetch --unshallow on a repository that is not shallow.

§

FetchShallowUnsupported

A deepen/shallow fetch was requested but the remote did not advertise the shallow capability.

§

FetchDeepenRelativeUnsupported

A --deepen fetch was requested but the remote did not advertise deepen-relative.

§

BundleMissingPrerequisites

A bundle fetch or verify found prerequisite commits missing from history.

§

ReceivedPackTempMissing

Streaming fetch/clone temp pack disappeared before index-pack (often real-time antivirus).

Fields

§path: PathBuf

Path to the temp pack that was expected on disk.

§

InvalidAttrPathspec

A pathspec’s :(attr:...) magic is malformed.

Fields

§spec: String

The offending pathspec as given.

§reason: AttrPathspecError

What is wrong with its attr clause.

§

PathspecNoMatch

A pathspec did not match any file known to Git (index or HEAD tree).

Fields

§spec: String

User-supplied pathspec that matched nothing.

§

RestoreConflictWithStaged

crate::porcelain::restore::restore_paths conflict options were combined with --staged.

§

RestoreConflictWithSource

crate::porcelain::restore::restore_paths conflict options were combined with --source.

§

RestoreConflictMissingTheirs

A conflict side was missing from the index for the requested path.

Fields

§path: String

Repository-relative path.

§

RestoreConflictMissingOurs

A conflict side was missing from the index for the requested path.

Fields

§path: String

Repository-relative path.

§

RestoreConflictNotUnmerged

Three-way remerge needs stages 1, 2, and 3 in the index.

Fields

§path: String

Repository-relative path.

§

RestorePathUnmerged

crate::porcelain::restore::restore_paths was asked to restore the worktree from the index for paths that still have conflict stages; pick a side or rebuild the markers instead.

Nothing is written when this is returned.

Fields

§paths: Vec<String>

Matched repository-relative paths with conflict stages (sorted, deduplicated).

A literal pathspec names a file under a symlink directory component.

Fields

§spec: String

User-supplied pathspec that crosses a symlink directory.

§

PartialCommitDuringMerge

crate::porcelain::commit::CommitScope::Paths was used while a merge is in progress.

§

PathspecIgnored

Explicit crate::porcelain::add::stage pathspecs name paths excluded by ignore rules.

Fields

§paths: Vec<String>

Repository-relative paths (or user labels) that cannot be staged while ignored.

§

RemoveBlocked

crate::porcelain::paths::remove_paths refused paths whose removal would lose content, because crate::porcelain::paths::RemoveOptions::force was not set.

Fields

§paths: Vec<BlockedRemoval>

Each refused path with the reason it was refused.

§

NotRemovingRecursively(String)

A directory pathspec was used without recursive (crate::porcelain::paths::remove_paths).

§

RequiresWorkTree

A porcelain path operation requires a checked-out work tree.

§

EmptyCommitMessage

A commit was requested with an empty message body after normalization.

§

RemovePathsRequired

crate::porcelain::paths::remove_paths was called with no pathspecs.

§

MoveSourceNotTracked

Fields

§src: String

Untracked or missing source path.

§

MoveDestinationExists

Move refused because the destination already exists without --force.

Fields

§src: String

Source path in the move request.

§destination: String

Existing destination path.

§

MoveIntoSubdirectory

Move refused because the destination lies under the source directory.

Fields

§src: String

Source directory path.

§destination: String

Invalid destination under the source.

§

MoveIntoSelf

Move refused because source and destination are the same path.

Fields

§src: String

Source path.

§destination: String

Destination equal to the source.

§

MoveNothingToMove

Move refused because the source has no index entries.

Fields

§src: String

Source path with no index entries.

§

MoveDuplicateDestination

Multi-source move would write more than one source to the same destination path.

Fields

§destination: String

Destination path that would receive more than one source.

§

MoveBadSource

A worktree source path is missing or not a file, directory, or symlink.

Fields

§src: String

Source path.

§destination: String

Planned destination path.

§

MoveMissingIndexEntry

Internal invariant: a planned rename references a missing index entry.

Fields

§path: String

Index path that should exist during a move.

§

RemoteUnreadable

The remote could not be read or written: a missing repository, a failed connection, an HTTP error status, or no Git handshake.

Use Error::is_remote_unreadable to test for it through wrapper errors.

Not used for cancellation; see Error::is_cancelled.

Fields

§url: Option<String>

Remote URL or resolved local path, with credentials redacted. None when the failing layer only had a connection, not the URL it was opened from.

§reason: RemoteUnreadableReason

What went wrong.

§

FetchRefspec(FetchRefspecError)

Explicit fetch refspec resolution failed (missing or ambiguous source).

§

FetchNonFastForward

Fetch refused to overwrite a local branch with a non-fast-forward update.

Fields

§local_ref: String

Local ref that would have been overwritten.

§

FetchIntoCheckedOutBranch

Fetch refused to update the branch checked out in this or a linked worktree.

Fields

§branch: String

Short branch name under refs/heads/.

§

WouldOverwrite

Checkout or switch would overwrite local or untracked worktree content.

Fields

§reason: OverwriteReason

Whether tracked local edits or untracked paths block the operation.

§paths: Vec<String>

Repository-relative paths that would be overwritten (sorted, deduplicated).

§message: String

Human-readable summary (depends on OverwriteReason).

§

DirtyWorktree

Staged or unstaged changes block an operation that needs a clean worktree.

Fields

§operation: WorktreeOperation

The operation that was refused.

§paths: Vec<String>

Repository-relative paths with staged or unstaged changes (sorted, deduplicated; empty when the caller only knew that something changed).

§

InvalidIdentity(CommitIdentityError)

Author or committer on crate::porcelain::commit::CommitRequest is invalid.

§

Cancelled

A long-running library operation stopped at a cancellation checkpoint.

Use Error::is_cancelled to test for it through wrapper errors (crate::remote::RemoteError::is_cancelled, crate::remote::clone::CloneError::is_cancelled, …).

§

Identity(IdentityError)

No usable author or committer identity is configured (crate::repo::Repository::identity).

§

Message(String)

User-facing message that should be printed verbatim (no extra prefix).

Used for revision errors that must match Git’s fatal: lines exactly.

§

NotFastForward

A merge was requested with fast-forward only, but the histories diverged.

§

NothingToCommit

The index tree matches the parent commit tree and allow_empty is false.

§

NothingStagedToCommit

No staged changes are available for a CommitScope::Staged commit, but the work tree has unstaged or untracked paths.

Fields

§unstaged: usize

Tracked paths that differ between the index and the work tree.

§untracked: usize

Untracked paths under the work tree.

§

DetachedHead

create_commit requires a branch checkout.

§

UnbornHead

HEAD is on a branch with no commits yet, but the operation needs a commit (Repository::head_commit, replay_commit).

§

InvalidHead

HEAD could not be resolved to a branch, detached commit, or unborn branch.

§

MergeCommit

replay_commit does not replay merge commits until callers can select a mainline parent explicitly.

Fields

§oid: ObjectId

Object id of the merge commit that cannot be replayed yet.

§

ReplaySourceAtHead

Cherry-pick source is already checked out as HEAD.

§

SequencerUnknownCommand

Sequencer todo lists a command grit does not implement yet.

Fields

§command: String

Verb read from .git/sequencer/todo.

§

ReplayAbortHeadMoved

abort_replay_sequence refuses when HEAD moved since the replay started.

§

ReplayContinueUnmerged

continue_replay_sequence refuses while unmerged index entries remain.

§

NoReplayInProgress

No cherry-pick or revert sequence is in progress.

§

OperationInProgress(InProgressOperation)

The command would move HEAD while a paused operation still depends on it (see operation_blocking_switch).

§

BranchCheckedOutInWorktree

A local branch is checked out as HEAD in a linked or main worktree.

Fields

§branch: String

Short branch name (e.g. main).

§worktree_path: String

Path to the worktree that has the branch checked out.

§

BranchNotFound

refs/heads/<branch> does not exist.

Fields

§branch: String

Short branch name (e.g. topic).

§

BranchListNamesDateSort

list_branches with BranchDetail::Names cannot use date sort.

§

CannotDeleteCurrentBranch

delete_branch refuses to delete the branch HEAD points at.

Fields

§branch: String

Short branch name (e.g. main).

§

BranchNotMerged

delete_branch without force found commits on the branch that are not reachable from its upstream (or from HEAD when it has none).

Fields

§branch: String

Short branch name (e.g. topic).

§

TagNotFound

refs/tags/<tag> does not exist.

Fields

§tag: String

Short tag name (e.g. v1.0).

§

Tag(TagError)

Tag create/delete validation failure (crate::porcelain::tag::TagError).

§

Worktree(WorktreeError)

Linked worktree add/remove/move/lock/repair failure (crate::worktree::WorktreeError).

§

CorruptStash(&'static str)

Stash commit object has fewer parents or an invalid shape for apply/show.

§

StashNotFound

stash@{{n}} is out of range for the current stash reflog.

Fields

§n: usize

Stash reflog index (stash@{{n}}).

§

ReflogUnknownRef

Ref does not exist and has no reflog entries.

Fields

§refname: String

User-supplied or DWIM ref name.

§

ReflogInvalidSelector

A reflog selector is missing its reference or @{n} delimiters.

Fields

§spec: String

Selector after trimming surrounding whitespace.

§

ReflogInvalidIndex

A reflog selector index is not a nonnegative integer that fits in usize.

Fields

§spec: String

Selector after trimming surrounding whitespace.

§source: ParseIntError

Integer parsing failure, including overflow.

§

ReflogIndexOutOfRange

ref@{{n}} is out of range for the current reflog.

Fields

§refname: String

Ref whose reflog was read.

§index: usize

Requested newest-first index.

§

StashNoInitialCommit

Pushing or creating a stash (crate::repo_handles::RepositoryStash::push) requires at least one commit.

§

StashBareRepository

Stash create/apply/pop requires a working tree (not a bare repository).

§

StashIndexConflict

crate::repo_handles::RepositoryStash::apply with restore_index could not merge the current index with the stashed index parent.

§

StashOptionConflict(String)

Incompatible StashPushOptions flags.

§

HunkSelection(HunkSelectError)

Partial crate::repo_handles::RepositoryStash::push hunk selection failed.

§

StashMissingHead

HEAD does not resolve while applying a stash entry.

§

StashWouldOverwriteLocalChanges

Applying a stash would overwrite locally modified worktree content.

Fields

§paths: String

Space-separated list of paths that would be overwritten.

§

StashIndexWrite(String)

The index could not be written after a successful stash apply.

§

StashSymlinkNotUtf8

A symlink blob in a stash commit is not valid UTF-8.

§

StashCouldNotRestoreUntracked

Applying a stash with an untracked-files parent would replace an existing worktree path.

Fields

§path: String

Worktree path that already exists and blocks untracked restore.

§

AmendUnborn

CommitRequest::amend was set on an unborn branch.

§

NoteAlreadyExists

RepositoryNotes::add was called without force when a note already exists on the object.

Fields

§object: ObjectId

Annotated object that already has a note.

§

InvalidNotesRef(String)

A configured or environment notes ref is not under refs/notes/.

§

NotesRefNotCommit

A notes ref resolves to an object that cannot hold notes (notes reads accept a commit or a tree; notes merges require a commit).

Fields

§notes_ref: String

Notes ref (or revision) that was read.

§found: ObjectKind

Kind of object the ref resolved to.

§

NotesObjectKind

An object reached while reading a notes tree has the wrong kind (for example a note entry that is not a blob).

Fields

§oid: ObjectId

Object that was read.

§expected: ObjectKind

Kind the notes layout requires at this position.

§found: ObjectKind

Kind actually stored.

§

NotesMergeBothEmpty

notes_merge_inner was asked to merge two notes refs that both have no notes commit.

Fields

§local: String

Local notes ref (merge destination).

§remote: String

Remote notes ref (merge source).

§

NotesMergeInProgress

A manual notes merge was started while an earlier one still has conflict files in the notes merge worktree.

Fields

§path: PathBuf

The notes merge worktree directory.

§

Midx(MidxError)

Multi-pack-index load or write failure.

§

RevParse(RevParseError)

Revision parsing failed (crate::rev_parse_error::RevParseError).

§

RevList(RevListError)

Revision walking / rev-list option parsing failed (crate::rev_list_error::RevListError).

§

Hook(HookError)

A Git hook subprocess failed or could not be started.

§

History(HistoryError)

History rewrite planning failed (crate::history::HistoryError).

§

UnsupportedObjectStore

The operation needs the files-backed objects/ directory, but the repository’s Odb uses a custom OdbBuilder::primary store. Nothing was written; use a files-backed repository for this operation.

Fields

§operation: &'static str

Operation that was refused (for example "fetch", "push", "gc").

§

OdbObjectsDirMismatch

RepositoryBuilder::open was given an OdbBuilder rooted somewhere other than the repository’s objects/ directory.

Fields

§builder: PathBuf

The builder’s objects directory, canonicalized when it exists.

§repository: PathBuf

The repository’s canonical objects directory.

§

TreeSha256InvalidHex

Parsing a crate::tree_sha256::TreeSha256 from hex failed (expected 64 hex digits).

§

TreeSha256InvalidRevision

A revision passed to crate::tree_sha256::tree_sha256 did not peel to a commit or tree.

Fields

§found: ObjectKind

Object kind after peeling annotated tags.

§

TreeSha256MissingSubmodules(Vec<MissingSubmodule>)

One or more submodules required for crate::tree_sha256::tree_sha256 are missing.

§

TreeSha256RequiresSigning

--tree-sha256 was requested with signing explicitly disabled.

§

TagVerifyNotTag

crate::tree_sha256::verify_tag was given an object that is not an annotated tag.

Fields

§oid: ObjectId

Object id passed to verification.

§found: ObjectKind

Kind stored in the ODB.

§

TagVerifyMissingObjectHeader

Annotated tag header block has no object line.

§

TagVerifyDuplicateTreeSha256Header

Annotated tag carries more than one tree-sha256 header line.

§

TreeSha256Claim(TreeSha256ClaimError)

Annotated tag tree-sha256 header parsing failed.

§

BlameIgnoreRevUnknown

grit blame --ignore-rev did not resolve to a commit.

Fields

§rev: String

Revision expression from --ignore-rev.

§

BlameIgnoreRevsFileOpen

--ignore-revs-file could not be read.

Fields

§path: String

Path argument (before expansion).

§source: Error

Underlying open error.

§

BlameIgnoreRevsFileInvalidRev

A line in an ignore-revs file is not a full-length object id.

Fields

§path: String

Path argument for the file.

§rev: String

Offending line text after comment/trim handling.

Implementations§

Source§

impl Error

Source

pub fn dirty_worktree(operation: WorktreeOperation, paths: Vec<String>) -> Self

Build Error::DirtyWorktree, sorting and deduplicating paths.

Source

pub fn would_overwrite(reason: OverwriteReason, paths: Vec<String>) -> Self

Build Error::WouldOverwrite for switch and similar tree transitions.

Source

pub fn remote_unreadable( url: impl Into<String>, reason: RemoteUnreadableReason, ) -> Self

Build Error::RemoteUnreadable for url.

Source

pub fn is_remote_unreadable(&self) -> bool

Whether this is Error::RemoteUnreadable: the remote could not be read or written at all (as opposed to a rejected update or an empty remote).

Source

pub fn is_cancelled(&self) -> bool

Whether this is Error::Cancelled or a nested history failure that was cancelled.

Source

pub fn invalid_path_component( path: impl Into<String>, reason: PathComponentError, ) -> Self

Source

pub fn wants_fatal_prefix(&self) -> bool

When set, the CLI should prefix stderr with fatal: for Git-compatible commands.

Source

pub fn git_stderr_message(&self) -> String

Format for Git-style stderr (adds fatal: / error: when appropriate).

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<ApplyError> for Error

Source§

fn from(source: ApplyError) -> Self

Converts to this type from the input type.
Source§

impl From<BranchError> for Error

Source§

fn from(source: BranchError) -> Self

Converts to this type from the input type.
Source§

impl From<CommitIdentityError> for Error

Source§

fn from(source: CommitIdentityError) -> Self

Converts to this type from the input type.
Source§

impl From<ConfigError> for Error

Source§

fn from(source: ConfigError) -> Self

Converts to this type from the input type.
Source§

impl From<DiffPathError> for Error

Source§

fn from(source: DiffPathError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CommitPatchError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for HunkSelectError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ContinueMergeError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for PullError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CloneError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ResolveDiffArgumentsError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for PartialCloneError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for BitmapWalkError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for HistoryError

Source§

fn from(err: Error) -> Self

Unwraps Error::History back to the history failure it carries; every other library error becomes HistoryError::Library.

Source§

impl From<Error> for RebaseSessionError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CompactError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for RefQueryError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for RemoteError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for UnpackError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ServeError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<FetchRefspecError> for Error

Source§

fn from(source: FetchRefspecError) -> Self

Converts to this type from the input type.
Source§

impl From<FilterError> for Error

Source§

fn from(source: FilterError) -> Self

Converts to this type from the input type.
Source§

impl From<HistoryError> for Error

Source§

fn from(source: HistoryError) -> Self

Converts to this type from the input type.
Source§

impl From<HookError> for Error

Source§

fn from(source: HookError) -> Self

Converts to this type from the input type.
Source§

impl From<HunkSelectError> for Error

Source§

fn from(source: HunkSelectError) -> Self

Converts to this type from the input type.
Source§

impl From<IdentityError> for Error

Source§

fn from(source: IdentityError) -> Self

Converts to this type from the input type.
Source§

impl From<LockError> for Error

Source§

fn from(err: LockError) -> Self

LockError::Held becomes Error::LockHeld with the recorded LockHolder, and I/O failures become Error::Io.

Source§

impl From<MidxError> for Error

Source§

fn from(source: MidxError) -> Self

Converts to this type from the input type.
Source§

impl From<NoIndexError> for Error

Source§

fn from(value: NoIndexError) -> Self

Converts to this type from the input type.
Source§

impl From<PathOutsideRepoError> for Error

Source§

fn from(source: PathOutsideRepoError) -> Self

Converts to this type from the input type.
Source§

impl From<PathspecFromFileParseError> for Error

Source§

fn from(source: PathspecFromFileParseError) -> Self

Converts to this type from the input type.
Source§

impl From<PickaxeError> for Error

Source§

fn from(value: PickaxeError) -> Self

Converts to this type from the input type.
Source§

impl From<RefLockError> for Error

Source§

fn from(source: RefLockError) -> Self

Converts to this type from the input type.
Source§

impl From<RefStoreError> for Error

Source§

fn from(err: RefStoreError) -> Self

Converts to this type from the input type.
Source§

impl From<ReftableError> for Error

Source§

fn from(source: ReftableError) -> Self

Converts to this type from the input type.
Source§

impl From<RemoteError> for Error

Source§

fn from(e: RemoteError) -> Self

Converts to this type from the input type.
Source§

impl From<RevListError> for Error

Source§

fn from(source: RevListError) -> Self

Converts to this type from the input type.
Source§

impl From<RevParseError> for Error

Source§

fn from(source: RevParseError) -> Self

Converts to this type from the input type.
Source§

impl From<SignatureError> for Error

Source§

fn from(source: SignatureError) -> Self

Converts to this type from the input type.
Source§

impl From<TagError> for Error

Source§

fn from(source: TagError) -> Self

Converts to this type from the input type.
Source§

impl From<TreeEntryError> for Error

Source§

fn from(source: TreeEntryError) -> Self

Converts to this type from the input type.
Source§

impl From<TreeSha256ClaimError> for Error

Source§

fn from(source: TreeSha256ClaimError) -> Self

Converts to this type from the input type.
Source§

impl From<WorktreeError> for Error

Source§

fn from(source: WorktreeError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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> Same for T

Source§

type Output = T

Should always be Self
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.