Skip to content

Commit

Permalink
Rollup merge of #133898 - onur-ozkan:ignore-git-hook-on-dist-sources,…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
jhpratt authored Dec 5, 2024
2 parents 3c58e5d + 34d6a26 commit 6b58941
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bootstrap/src/core/build_steps/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down

0 comments on commit 6b58941

Please sign in to comment.