]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/setup.rs
Auto merge of #98017 - RalfJung:dereferenceable, r=nikic
[rust.git] / src / bootstrap / setup.rs
index 740c12ed725e1ee8e61d54b766e04da9a7c97fd1..a5a39a5a3cfc6355cc784d15ac65cb82944bfbf0 100644 (file)
@@ -136,7 +136,7 @@ pub fn setup(config: &Config, profile: Profile) {
 
     println!();
 
-    t!(install_git_hook_maybe(&config.src));
+    t!(install_git_hook_maybe(&config));
 
     println!();
 
@@ -302,7 +302,7 @@ fn parse_with_abbrev(input: &str) -> Result<Profile, String> {
 }
 
 // install a git hook to automatically run tidy --bless, if they want
-fn install_git_hook_maybe(src_path: &Path) -> io::Result<()> {
+fn install_git_hook_maybe(config: &Config) -> io::Result<()> {
     let mut input = String::new();
     println!(
         "Rust's CI will automatically fail if it doesn't pass `tidy`, the internal tool for ensuring code quality.
@@ -328,13 +328,12 @@ fn install_git_hook_maybe(src_path: &Path) -> io::Result<()> {
     };
 
     if should_install {
-        let src = src_path.join("src").join("etc").join("pre-push.sh");
-        let git = t!(Command::new("git").args(&["rev-parse", "--git-common-dir"]).output().map(
-            |output| {
+        let src = config.src.join("src").join("etc").join("pre-push.sh");
+        let git =
+            t!(config.git().args(&["rev-parse", "--git-common-dir"]).output().map(|output| {
                 assert!(output.status.success(), "failed to run `git`");
                 PathBuf::from(t!(String::from_utf8(output.stdout)).trim())
-            }
-        ));
+            }));
         let dst = git.join("hooks").join("pre-push");
         match fs::hard_link(src, &dst) {
             Err(e) => eprintln!(