Skip to content

Commit 427f039

Browse files
committed
Only update src/llvm-project submodule if already existing
1 parent a60a9e5 commit 427f039

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Diff for: src/bootstrap/src/core/config/config.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -2509,6 +2509,18 @@ impl Config {
25092509
}
25102510
}
25112511

2512+
/// Updates the given submodule only if it's initialized already; nothing happens otherwise.
2513+
pub(crate) fn update_existing_submodule(&self, submodule: &str) {
2514+
// Avoid running git when there isn't a git checkout.
2515+
if !self.submodules() {
2516+
return;
2517+
}
2518+
2519+
if GitInfo::new(false, Path::new(submodule)).is_managed_git_subrepository() {
2520+
self.update_submodule(submodule);
2521+
}
2522+
}
2523+
25122524
/// Given a path to the directory of a submodule, update it.
25132525
///
25142526
/// `relative_path` should be relative to the root of the git repository, not an absolute path.
@@ -2738,7 +2750,7 @@ impl Config {
27382750
return false;
27392751
}
27402752

2741-
self.update_submodule("src/llvm-project");
2753+
self.update_existing_submodule("src/llvm-project");
27422754

27432755
// Check for untracked changes in `src/llvm-project`.
27442756
let has_changes = self

Diff for: src/bootstrap/src/lib.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,7 @@ impl Build {
542542

543543
/// Updates the given submodule only if it's initialized already; nothing happens otherwise.
544544
pub fn update_existing_submodule(&self, submodule: &str) {
545-
// Avoid running git when there isn't a git checkout.
546-
if !self.config.submodules() {
547-
return;
548-
}
549-
550-
if GitInfo::new(false, Path::new(submodule)).is_managed_git_subrepository() {
551-
self.config.update_submodule(submodule);
552-
}
545+
self.config.update_existing_submodule(submodule)
553546
}
554547

555548
/// Executes the entire build, as configured by the flags and configuration.

0 commit comments

Comments
 (0)