Skip to content

Commit

Permalink
git: do not validate submodules of fresh checkouts
Browse files Browse the repository at this point in the history
Fixes #14603
  • Loading branch information
osiewicz committed Nov 11, 2024
1 parent 996966c commit f23e258
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,20 @@ impl GitDatabase {
// A non-fresh checkout can happen if the checkout operation was
// interrupted. In that case, the checkout gets deleted and a new
// clone is created.
let (checkout, guard) = match git2::Repository::open(dest)
let checkout = match git2::Repository::open(dest)
.ok()
.map(|repo| GitCheckout::new(self, rev, repo))
.filter(|co| co.is_fresh())
{
Some(co) => (co, None),
None => GitCheckout::clone_into(dest, self, rev, gctx)
.map(|(co, guard)| (co, Some(guard)))?,
Some(co) => co,
None => {
let (checkout, guard) = GitCheckout::clone_into(dest, self, rev, gctx)?;
checkout.update_submodules(gctx)?;
guard.mark_ok()?;
checkout
}
};
checkout.update_submodules(gctx)?;
if let Some(guard) = guard {
guard.mark_ok()?;
}

Ok(checkout)
}

Expand Down

0 comments on commit f23e258

Please sign in to comment.