Skip to content

Commit 3bbb44c

Browse files
committed
Reinitialize index on "Object not found" error.
1 parent 05c611a commit 3bbb44c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ pub fn fetch(
953953
};
954954
debug!("fetch failed: {}", err);
955955

956-
if !repo_reinitialized && err.class() == git2::ErrorClass::Reference {
956+
if !repo_reinitialized && matches!(err.class(), ErrorClass::Reference | ErrorClass::Odb)
957+
{
957958
repo_reinitialized = true;
958959
debug!(
959960
"looks like this is a corrupt repository, reinitializing \

0 commit comments

Comments
 (0)