Skip to content

Commit 48b782a

Browse files
committed
detect spurious errors during gitoxide fetch operations specifically
It works by delegating to the respective error types, which know what to do and whose implementation is modelled after the one found here.
1 parent 72803ba commit 48b782a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/cargo/util/network.rs

+20
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,26 @@ fn maybe_spurious(err: &Error) -> bool {
7979
return true;
8080
}
8181
}
82+
83+
use git::protocol::transport::IsSpuriousError;
84+
use git_repository as git;
85+
86+
if let Some(err) = err.downcast_ref::<git::remote::connect::Error>() {
87+
if err.is_spurious() {
88+
return true;
89+
}
90+
}
91+
if let Some(err) = err.downcast_ref::<git::remote::fetch::prepare::Error>() {
92+
if err.is_spurious() {
93+
return true;
94+
}
95+
}
96+
if let Some(err) = err.downcast_ref::<git::remote::fetch::Error>() {
97+
if err.is_spurious() {
98+
return true;
99+
}
100+
}
101+
82102
false
83103
}
84104

0 commit comments

Comments
 (0)