Skip to content

Commit

Permalink
detect spurious errors during gitoxide fetch operations specifically
Browse files Browse the repository at this point in the history
It works by delegating to the respective error types, which know what
to do and whose implementation is modelled after the one found here.
  • Loading branch information
Byron committed Dec 7, 2022
1 parent 72803ba commit 48b782a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/cargo/util/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,26 @@ fn maybe_spurious(err: &Error) -> bool {
return true;
}
}

use git::protocol::transport::IsSpuriousError;
use git_repository as git;

if let Some(err) = err.downcast_ref::<git::remote::connect::Error>() {
if err.is_spurious() {
return true;
}
}
if let Some(err) = err.downcast_ref::<git::remote::fetch::prepare::Error>() {
if err.is_spurious() {
return true;
}
}
if let Some(err) = err.downcast_ref::<git::remote::fetch::Error>() {
if err.is_spurious() {
return true;
}
}

false
}

Expand Down

0 comments on commit 48b782a

Please sign in to comment.