@@ -556,12 +556,18 @@ impl Build {
556
556
continue
557
557
}
558
558
559
+ if !submodule. path . exists ( ) {
560
+ t ! ( fs:: create_dir_all( & submodule. path) ) ;
561
+ }
562
+
559
563
match submodule. state {
560
564
State :: MaybeDirty => {
561
565
// drop staged changes
562
- self . run ( git ( ) . arg ( "-C" ) . arg ( submodule. path ) . args ( & [ "reset" , "--hard" ] ) ) ;
566
+ self . run ( git ( ) . current_dir ( submodule. path )
567
+ . args ( & [ "reset" , "--hard" ] ) ) ;
563
568
// drops unstaged changes
564
- self . run ( git ( ) . arg ( "-C" ) . arg ( submodule. path ) . args ( & [ "clean" , "-fdx" ] ) ) ;
569
+ self . run ( git ( ) . current_dir ( submodule. path )
570
+ . args ( & [ "clean" , "-fdx" ] ) ) ;
565
571
} ,
566
572
State :: NotInitialized => {
567
573
self . run ( git_submodule ( ) . arg ( "init" ) . arg ( submodule. path ) ) ;
@@ -570,8 +576,10 @@ impl Build {
570
576
State :: OutOfSync => {
571
577
// drops submodule commits that weren't reported to the (outer) git repository
572
578
self . run ( git_submodule ( ) . arg ( "update" ) . arg ( submodule. path ) ) ;
573
- self . run ( git ( ) . arg ( "-C" ) . arg ( submodule. path ) . args ( & [ "reset" , "--hard" ] ) ) ;
574
- self . run ( git ( ) . arg ( "-C" ) . arg ( submodule. path ) . args ( & [ "clean" , "-fdx" ] ) ) ;
579
+ self . run ( git ( ) . current_dir ( submodule. path )
580
+ . args ( & [ "reset" , "--hard" ] ) ) ;
581
+ self . run ( git ( ) . current_dir ( submodule. path )
582
+ . args ( & [ "clean" , "-fdx" ] ) ) ;
575
583
} ,
576
584
}
577
585
}
0 commit comments