skip setup::Hook on non-git sources
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
ae3703cdf2
commit
34d6a269e9
1 changed files with 6 additions and 4 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue