Rollup merge of #104953 - jyn514:fewer-submodule-updates, r=Mark-Simulacrum
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 affecting `cargo metadata` somehow. This is based on https://github.com/rust-lang/rust/pull/104952 for convenience to avoid merge conflicts, but doesn't depend on that PR.
This commit is contained in:
commit
f4643f59cb
@ -579,6 +579,8 @@ pub fn new(mut config: Config) -> Build {
|
|||||||
for s in rust_submodules {
|
for s in rust_submodules {
|
||||||
build.update_submodule(Path::new(s));
|
build.update_submodule(Path::new(s));
|
||||||
}
|
}
|
||||||
|
// Now, update all existing submodules.
|
||||||
|
build.update_existing_submodules();
|
||||||
|
|
||||||
build.verbose("learning about cargo");
|
build.verbose("learning about cargo");
|
||||||
metadata::build(&mut build);
|
metadata::build(&mut build);
|
||||||
@ -674,7 +676,7 @@ fn dir_is_empty(dir: &Path) -> bool {
|
|||||||
|
|
||||||
/// If any submodule has been initialized already, sync it unconditionally.
|
/// If any submodule has been initialized already, sync it unconditionally.
|
||||||
/// This avoids contributors checking in a submodule change by accident.
|
/// 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.
|
// Avoid running git when there isn't a git checkout.
|
||||||
if !self.config.submodules(&self.rust_info()) {
|
if !self.config.submodules(&self.rust_info()) {
|
||||||
return;
|
return;
|
||||||
@ -703,8 +705,6 @@ pub fn build(&mut self) {
|
|||||||
job::setup(self);
|
job::setup(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.maybe_update_submodules();
|
|
||||||
|
|
||||||
if let Subcommand::Format { check, paths } = &self.config.cmd {
|
if let Subcommand::Format { check, paths } = &self.config.cmd {
|
||||||
return format::format(&builder::Builder::new(&self), *check, &paths);
|
return format::format(&builder::Builder::new(&self), *check, &paths);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user