about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-12-05 05:50:55 -0500
committerGitHub <noreply@github.com>2024-12-05 05:50:55 -0500
commit6b58941688695d707589bb9df4137a3904541f63 (patch)
tree70bea7f0ac9b403585bbe8508cdb419007802c6f
parent3c58e5d522ca8c332b34278e2867963b450471b5 (diff)
parent34d6a269e9fe57af7b389fdea1a49b5a3654c67e (diff)
downloadrust-6b58941688695d707589bb9df4137a3904541f63.tar.gz
rust-6b58941688695d707589bb9df4137a3904541f63.zip
Rollup merge of #133898 - onur-ozkan:ignore-git-hook-on-dist-sources, r=jieyouxu
skip `setup::Hook` on non-git sources

Running `setup::Hook` (with `x setup`) leads tarball sources to panic and this PR resolves that problem by skipping `Hook` step on non-git sources.
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 3a8f9e48c0d..7ed01f25c94 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -452,24 +452,26 @@ pub struct Hook;
 impl Step for Hook {
     type Output = ();
     const DEFAULT: bool = true;
+
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         run.alias("hook")
     }
+
     fn make_run(run: RunConfig<'_>) {
-        if run.builder.config.dry_run() {
-            return;
-        }
         if let [cmd] = &run.paths[..] {
             if cmd.assert_single_path().path.as_path().as_os_str() == "hook" {
                 run.builder.ensure(Hook);
             }
         }
     }
+
     fn run(self, builder: &Builder<'_>) -> Self::Output {
         let config = &builder.config;
-        if config.dry_run() {
+
+        if config.dry_run() || !config.rust_info.is_managed_git_subrepository() {
             return;
         }
+
         t!(install_git_hook_maybe(builder, config));
     }
 }