@@ -490,14 +490,25 @@ impl Build {
490490 return ;
491491 }
492492
493- let submodule_git = || helpers:: git ( Some ( & absolute_path) ) . capture_stdout ( ) ;
493+ // Submodule updating actually happens during in the dry run mode. We need to make sure that
494+ // all the git commands below are actually executed, because some follow-up code
495+ // in bootstrap might depend on the submodules being checked out. Furthermore, not all
496+ // the command executions below work with an empty output (produced during dry run).
497+ // Therefore, all commands below are marked with `run_always()`, so that they also run in
498+ // dry run mode.
499+ let submodule_git = || {
500+ let mut cmd = helpers:: git ( Some ( & absolute_path) ) . capture_stdout ( ) ;
501+ cmd. run_always ( ) ;
502+ cmd
503+ } ;
494504
495505 // Determine commit checked out in submodule.
496506 let checked_out_hash = submodule_git ( ) . args ( [ "rev-parse" , "HEAD" ] ) . run ( self ) . stdout ( ) ;
497507 let checked_out_hash = checked_out_hash. trim_end ( ) ;
498508 // Determine commit that the submodule *should* have.
499509 let recorded = helpers:: git ( Some ( & self . src ) )
500510 . capture_stdout ( )
511+ . run_always ( )
501512 . args ( [ "ls-tree" , "HEAD" ] )
502513 . arg ( relative_path)
503514 . run ( self )
@@ -514,6 +525,7 @@ impl Build {
514525
515526 println ! ( "Updating submodule {}" , relative_path. display( ) ) ;
516527 helpers:: git ( Some ( & self . src ) )
528+ . run_always ( )
517529 . args ( [ "submodule" , "-q" , "sync" ] )
518530 . arg ( relative_path)
519531 . run ( self ) ;
@@ -524,12 +536,14 @@ impl Build {
524536 // even though that has no relation to the upstream for the submodule.
525537 let current_branch = helpers:: git ( Some ( & self . src ) )
526538 . capture_stdout ( )
539+ . run_always ( )
527540 . args ( [ "symbolic-ref" , "--short" , "HEAD" ] )
528541 . run ( self )
529542 . stdout_if_ok ( )
530543 . map ( |s| s. trim ( ) . to_owned ( ) ) ;
531544
532545 let mut git = helpers:: git ( Some ( & self . src ) ) . allow_failure ( ) ;
546+ git. run_always ( ) ;
533547 if let Some ( branch) = current_branch {
534548 // If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
535549 // This syntax isn't accepted by `branch.{branch}`. Strip it.
0 commit comments