#[non_exhaustive]pub enum RefStoreError {
Show 18 variants
ReflogRewriteStale {
name: String,
},
LockHeld {
name: String,
},
ExpectedMismatch {
name: String,
expected: Expected,
actual: Option<RawRef>,
},
NameUnavailable {
reason: RefnameUnavailable,
},
DuplicateUpdate {
name: String,
},
SymrefLoop,
NotFound {
name: String,
},
Corrupt(String),
GitDirPathIo {
path: String,
operation: GitDirPathOperation,
os_error: i32,
},
InvalidRefName {
name: String,
},
InvalidSymrefTarget {
name: String,
target: String,
},
NullOid {
name: String,
},
MissingObject {
name: String,
oid: ObjectId,
},
NotACommit {
name: String,
oid: ObjectId,
kind: ObjectKind,
},
ObjectLookup {
name: String,
oid: ObjectId,
source: BackendError,
},
InvalidReflog(SignatureError),
Backend(BackendError),
Hook(ReferenceTransactionHookErr),
}Expand description
Failure modes for reference store reads and transactions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ReflogRewriteStale
Reflog contents changed between a snapshot and a locked super::RefStore::rewrite_reflog
re-read. Callers that compare against an earlier snapshot should retry.
LockHeld
Another writer holds a lock this transaction needs.
For per-ref backends (files) that is the lock of name itself; for a backend with one
writer slot for the whole store (super::MemoryRefStore, a database with a single
write transaction) it means that slot is busy, whichever refs the holder updates.
Transient: crate::refs::prepare_with_lock_wait retries it.
Fields
ExpectedMismatch
Compare-and-swap or existence check failed for an update.
Fields
A ref name cannot be created because of a directory/file conflict.
DuplicateUpdate
The same ref name appears more than once in one transaction.
SymrefLoop
Symbolic reference resolution exceeded crate::refs::SYMREF_MAXDEPTH.
NotFound
The ref (or the target at the end of its symbolic chain) does not exist.
Corrupt(String)
Stored data for a ref or reflog is malformed.
GitDirPathIo
Filesystem I/O on a git-directory path during ref store work.
Fields
operation: GitDirPathOperationWhat the operation was trying to do when I/O failed.
InvalidRefName
Ref name is not safe to store (traversal, illegal component, etc.).
Every backend checks update names and both sides of reflog and case-only renames
in super::RefStore::prepare, before taking locks.
InvalidSymrefTarget
A symbolic ref would point at a target Git refuses (outside refs/ for HEAD, not
safe to store, or the same name as the ref being updated).
NullOid
An update would store the all-zero (null) object id as a direct ref value.
The null id names no object, so Git treats such a ref as broken. Delete a ref with
new_value: None instead. Reflog-only updates
(super::RefUpdateFlags::log_only) may still carry the null id.
MissingObject
An update would point a ref at an object the repository does not store.
Raised by the stores a crate::repo::Repository hands out (see
super::RefStore::prepare); the bare backends do not look at objects. Set
super::RefUpdateFlags::skip_oid_verification to write such a ref on purpose.
NotACommit
An update would point a branch (refs/heads/…) or HEAD at something other than a
commit.
Checked alongside Self::MissingObject. Tags, remote-tracking and other refs may
name any object.
Fields
kind: ObjectKindWhat oid actually is.
ObjectLookup
Looking up the object an update would store failed (unreadable pack, I/O, a failing custom object store), so the update could not be checked.
Fields
source: BackendErrorThe object database error, downcastable to crate::error::Error.
InvalidReflog(SignatureError)
Reflog identity or message would forge or corrupt a log line.
Backend(BackendError)
A custom backend’s own storage failed (database, network, …).
Built-in backends never return this; their I/O failures stay typed elsewhere.
Hook(ReferenceTransactionHookErr)
A reference-transaction hook refused or could not run on the prepared phase.
Implementations§
Source§impl RefStoreError
impl RefStoreError
Trait Implementations§
Source§impl Clone for RefStoreError
impl Clone for RefStoreError
Source§impl Debug for RefStoreError
impl Debug for RefStoreError
Source§impl Display for RefStoreError
impl Display for RefStoreError
impl Eq for RefStoreError
Source§impl Error for RefStoreError
impl Error for RefStoreError
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()
Source§impl From<BackendError> for RefStoreError
impl From<BackendError> for RefStoreError
Source§fn from(err: BackendError) -> Self
fn from(err: BackendError) -> Self
Source§impl From<RefStoreError> for Error
impl From<RefStoreError> for Error
Source§fn from(err: RefStoreError) -> Self
fn from(err: RefStoreError) -> Self
Source§fn from(reason: RefnameUnavailable) -> Self
fn from(reason: RefnameUnavailable) -> Self
Source§impl From<SignatureError> for RefStoreError
impl From<SignatureError> for RefStoreError
Source§fn from(source: SignatureError) -> Self
fn from(source: SignatureError) -> Self
Source§impl PartialEq for RefStoreError
impl PartialEq for RefStoreError
impl StructuralPartialEq for RefStoreError
Auto Trait Implementations§
impl !RefUnwindSafe for RefStoreError
impl !UnwindSafe for RefStoreError
impl Freeze for RefStoreError
impl Send for RefStoreError
impl Sync for RefStoreError
impl Unpin for RefStoreError
impl UnsafeUnpin for RefStoreError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.