Skip hook if no globs are matched.
This commit is contained in:
parent
651699c40a
commit
e4ed623e64
|
@ -53,8 +53,7 @@ pub fn hooked_run(config: Config, hook_type: String) -> Result<()> {
|
||||||
.args(&["diff", "--name-only", "--cached"])
|
.args(&["diff", "--name-only", "--cached"])
|
||||||
.capture()?
|
.capture()?
|
||||||
.stdout_str();
|
.stdout_str();
|
||||||
for line in staged_files.lines() {
|
if !staged_files.lines().any(|line| globs.is_match(line)) {
|
||||||
if globs.is_match(line) {
|
|
||||||
println!(
|
println!(
|
||||||
"\t{} {}",
|
"\t{} {}",
|
||||||
"≫".style(skipped_style),
|
"≫".style(skipped_style),
|
||||||
|
@ -63,7 +62,6 @@ pub fn hooked_run(config: Config, hook_type: String) -> Result<()> {
|
||||||
continue 'hook_loop;
|
continue 'hook_loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let command = match (hook.task.command, hook.task.script) {
|
let command = match (hook.task.command, hook.task.script) {
|
||||||
(Some(command), _) => Ok(Exec::shell(command)),
|
(Some(command), _) => Ok(Exec::shell(command)),
|
||||||
|
|
Loading…
Reference in New Issue