This commit is contained in:
JulianMaurin 2025-08-25 23:20:07 +02:00
parent e70b313c80
commit 9de4f9a409
No known key found for this signature in database
GPG key ID: B899586E1BC8E1B6
2 changed files with 5 additions and 1 deletions

View file

@ -298,7 +298,7 @@ def _run_hooks(
verbose=args.verbose, use_color=args.color,
)
retval |= current_retval
if current_retval and (config['fail_fast'] or hook.fail_fast):
if current_retval and (config['fail_fast'] or hook.fail_fast or args.fail_fast):
break
if retval and args.show_diff_on_failure and prior_diff:
if args.all_files:

View file

@ -76,6 +76,10 @@ def _add_run_options(parser: argparse.ArgumentParser) -> None:
'--show-diff-on-failure', action='store_true',
help='When hooks fail, run `git diff` directly afterward.',
)
parser.add_argument(
'--fail-fast', action='store_true', default=False,
help='Stop after the first failing hook.',
)
parser.add_argument(
'--hook-stage',
choices=clientlib.STAGES,