File tree 1 file changed +6
-1
lines changed
src/bootstrap/src/core/build_steps
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -469,7 +469,8 @@ fn install_git_hook_maybe(config: &Config) -> io::Result<()> {
469
469
assert!( output. status. success( ) , "failed to run `git`" ) ;
470
470
PathBuf :: from( t!( String :: from_utf8( output. stdout) ) . trim( ) )
471
471
} ) ) ;
472
- let dst = git. join ( "hooks" ) . join ( "pre-push" ) ;
472
+ let hooks_dir = git. join ( "hooks" ) ;
473
+ let dst = hooks_dir. join ( "pre-push" ) ;
473
474
if dst. exists ( ) {
474
475
// The git hook has already been set up, or the user already has a custom hook.
475
476
return Ok ( ( ) ) ;
@@ -486,6 +487,10 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
486
487
println ! ( "Ok, skipping installation!" ) ;
487
488
return Ok ( ( ) ) ;
488
489
}
490
+ if !hooks_dir. exists ( ) {
491
+ // We need to (try to) create the hooks directory first.
492
+ let _ = fs:: create_dir ( hooks_dir) ;
493
+ }
489
494
let src = config. src . join ( "src" ) . join ( "etc" ) . join ( "pre-push.sh" ) ;
490
495
match fs:: hard_link ( src, & dst) {
491
496
Err ( e) => {
You can’t perform that action at this time.
0 commit comments