@@ -490,14 +490,26 @@ impl Build {
490
490
return ;
491
491
}
492
492
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
+ } ;
494
504
495
505
// Determine commit checked out in submodule.
496
- let checked_out_hash = submodule_git ( ) . args ( [ "rev-parse" , "HEAD" ] ) . run ( self ) . stdout ( ) ;
506
+ let checked_out_hash =
507
+ submodule_git ( ) . run_always ( ) . args ( [ "rev-parse" , "HEAD" ] ) . run ( self ) . stdout ( ) ;
497
508
let checked_out_hash = checked_out_hash. trim_end ( ) ;
498
509
// Determine commit that the submodule *should* have.
499
510
let recorded = helpers:: git ( Some ( & self . src ) )
500
511
. capture_stdout ( )
512
+ . run_always ( )
501
513
. args ( [ "ls-tree" , "HEAD" ] )
502
514
. arg ( relative_path)
503
515
. run ( self )
@@ -514,6 +526,7 @@ impl Build {
514
526
515
527
println ! ( "Updating submodule {}" , relative_path. display( ) ) ;
516
528
helpers:: git ( Some ( & self . src ) )
529
+ . run_always ( )
517
530
. args ( [ "submodule" , "-q" , "sync" ] )
518
531
. arg ( relative_path)
519
532
. run ( self ) ;
@@ -524,12 +537,14 @@ impl Build {
524
537
// even though that has no relation to the upstream for the submodule.
525
538
let current_branch = helpers:: git ( Some ( & self . src ) )
526
539
. capture_stdout ( )
540
+ . run_always ( )
527
541
. args ( [ "symbolic-ref" , "--short" , "HEAD" ] )
528
542
. run ( self )
529
543
. stdout_if_ok ( )
530
544
. map ( |s| s. trim ( ) . to_owned ( ) ) ;
531
545
532
546
let mut git = helpers:: git ( Some ( & self . src ) ) . allow_failure ( ) ;
547
+ git. run_always ( ) ;
533
548
if let Some ( branch) = current_branch {
534
549
// If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
535
550
// This syntax isn't accepted by `branch.{branch}`. Strip it.
0 commit comments