From ab89c171bdb29194baca274decf86acfecd2bb9d Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 26 Nov 2022 16:11:07 -0500 Subject: [PATCH] Ensure required submodules at the same time as updating existing submodules In practice, this would always happen at the same time, but putting them next to each other makes that more obvious and ensures it doesn't change in the future. It also avoids the difference avoiding `cargo metadata` somehow. --- src/bootstrap/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 60ce431cb0c39..86b195fb89e02 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -579,6 +579,8 @@ impl Build { for s in rust_submodules { build.update_submodule(Path::new(s)); } + // Now, update all existing submodules. + build.update_existing_submodules(); build.verbose("learning about cargo"); metadata::build(&mut build); @@ -660,7 +662,7 @@ impl Build { /// If any submodule has been initialized already, sync it unconditionally. /// This avoids contributors checking in a submodule change by accident. - pub fn maybe_update_submodules(&self) { + pub fn update_existing_submodules(&self) { // Avoid running git when there isn't a git checkout. if !self.config.submodules(&self.rust_info()) { return; @@ -689,8 +691,6 @@ impl Build { job::setup(self); } - self.maybe_update_submodules(); - if let Subcommand::Format { check, paths } = &self.config.cmd { return format::format(&builder::Builder::new(&self), *check, &paths); }