pub enum CloneError {
DestNotEmpty(String),
RemoteRefNotFound(String),
InvalidCloneDepth,
Library(Error),
Remote(RemoteError),
CheckoutFailed {
path: PathBuf,
commit: ObjectId,
source: Box<Error>,
},
}Expand description
Errors during clone.
Variants§
DestNotEmpty(String)
Destination exists and is not empty.
Grit does not create or modify the destination in this case; callers must not run
cleanup_failed_clone on the path.
RemoteRefNotFound(String)
Named branch or tag from CloneOptions::branch was not advertised by the remote.
InvalidCloneDepth
CloneOptions::depth was zero (git clone --depth 0 is invalid).
Library(Error)
Underlying library failure.
Remote(RemoteError)
Remote resolution or transport failure.
CheckoutFailed
Every object and ref arrived and HEAD is set, but checking out the work tree
failed, for example because a partial clone could not fetch the blobs it needs.
As with Git, the repository is kept so the checkout can be retried (for example
with a hard reset to HEAD); Self::should_cleanup_failed_clone is false. A
checkout cancelled part way is CloneError::Library with Error::Cancelled
instead, and is cleaned up like any other cancelled clone.
Implementations§
Source§impl CloneError
impl CloneError
Sourcepub fn should_cleanup_failed_clone(&self) -> bool
pub fn should_cleanup_failed_clone(&self) -> bool
Whether cleanup_failed_clone may run after this failure.
Returns false when the destination must be left unchanged: CloneError::DestNotEmpty
and pre-initialization failures such as RemoteError::InvalidRemoteName, and
CloneError::CheckoutFailed, whose repository is kept.
Sourcepub fn is_remote_ref_not_found(&self) -> bool
pub fn is_remote_ref_not_found(&self) -> bool
Whether the failure is a missing -b / --branch ref (destination may be removed).
Sourcepub fn is_remote_unreadable(&self) -> bool
pub fn is_remote_unreadable(&self) -> bool
Whether the source could not be read at all (Error::RemoteUnreadable), as opposed to
an empty remote with no branches or a local failure.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the clone was cancelled (Error::Cancelled).
When this returns true, Self::should_cleanup_failed_clone is also true.
Sourcepub fn kept_repository(&self) -> Option<&Path>
pub fn kept_repository(&self) -> Option<&Path>
The repository a failed clone left in place (CloneError::CheckoutFailed).
§Returns
The clone destination when the fetch and ref setup succeeded and only the
checkout failed; None for every other failure.
Sourcepub fn missing_promised_object(&self) -> Option<ObjectId>
pub fn missing_promised_object(&self) -> Option<ObjectId>
The promised object a CloneError::CheckoutFailed checkout could not get.
§Returns
The first object still missing when the checkout failed on
Error::PromisorFetchFailed or Error::PromisedObjectMissing (for example
with lazy fetch turned off); None otherwise.
Sourcepub fn failed_promisor_remotes(&self) -> &[(String, Error)]
pub fn failed_promisor_remotes(&self) -> &[(String, Error)]
The promisor remotes that failed while a CloneError::CheckoutFailed checkout
fetched its missing objects.
§Returns
Each failing remote’s name with its first error, in the order they were tried;
empty when the checkout did not fail on Error::PromisorFetchFailed.
Trait Implementations§
Source§impl Debug for CloneError
impl Debug for CloneError
Source§impl Display for CloneError
impl Display for CloneError
Source§impl Error for CloneError
impl Error for CloneError
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()