File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments