Skip to content

Commit f23e258

Browse files
committed
git: do not validate submodules of fresh checkouts
Fixes #14603
1 parent 996966c commit f23e258

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/cargo/sources/git/utils.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,20 @@ impl GitDatabase {
194194
// A non-fresh checkout can happen if the checkout operation was
195195
// interrupted. In that case, the checkout gets deleted and a new
196196
// clone is created.
197-
let (checkout, guard) = match git2::Repository::open(dest)
197+
let checkout = match git2::Repository::open(dest)
198198
.ok()
199199
.map(|repo| GitCheckout::new(self, rev, repo))
200200
.filter(|co| co.is_fresh())
201201
{
202-
Some(co) => (co, None),
203-
None => GitCheckout::clone_into(dest, self, rev, gctx)
204-
.map(|(co, guard)| (co, Some(guard)))?,
202+
Some(co) => co,
203+
None => {
204+
let (checkout, guard) = GitCheckout::clone_into(dest, self, rev, gctx)?;
205+
checkout.update_submodules(gctx)?;
206+
guard.mark_ok()?;
207+
checkout
208+
}
205209
};
206-
checkout.update_submodules(gctx)?;
207-
if let Some(guard) = guard {
208-
guard.mark_ok()?;
209-
}
210+
210211
Ok(checkout)
211212
}
212213

0 commit comments

Comments
 (0)