From 922fdd84627aa40237ca7adab07719fd98d4378b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 25 Jul 2024 16:15:59 -0700 Subject: [PATCH] Remove argument from the submodules method The argument was not necessary, since it was only ever passed one value that exists in the config itself. --- src/bootstrap/src/core/config/config.rs | 7 +++++-- src/bootstrap/src/lib.rs | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index e32288e2caf6..3435225af7bd 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2404,8 +2404,11 @@ impl Config { .unwrap_or_else(|| SplitDebuginfo::default_for_platform(target)) } - pub fn submodules(&self, rust_info: &GitInfo) -> bool { - self.submodules.unwrap_or(rust_info.is_managed_git_subrepository()) + /// Returns whether or not submodules should be managed by bootstrap. + pub fn submodules(&self) -> bool { + // If not specified in config, the default is to only manage + // submodules if we're currently inside a git repository. + self.submodules.unwrap_or(self.rust_info.is_managed_git_subrepository()) } pub fn codegen_backends(&self, target: TargetSelection) -> &[String] { diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index ab640bf39aae..e8f412d785d5 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -475,7 +475,7 @@ impl Build { /// /// `relative_path` should be relative to the root of the git repository, not an absolute path. pub(crate) fn update_submodule(&self, relative_path: &Path) { - if !self.config.submodules(self.rust_info()) { + if !self.config.submodules() { return; } @@ -585,7 +585,7 @@ impl Build { fn update_existing_submodules(&self) { // Avoid running git when there isn't a git checkout, or the user has // explicitly disabled submodules in `config.toml`. - if !self.config.submodules(self.rust_info()) { + if !self.config.submodules() { return; } let output = helpers::git(Some(&self.src)) @@ -609,7 +609,7 @@ impl Build { /// Updates the given submodule only if it's initialized already; nothing happens otherwise. pub fn update_existing_submodule(&self, submodule: &Path) { // Avoid running git when there isn't a git checkout. - if !self.config.submodules(self.rust_info()) { + if !self.config.submodules() { return; }