fix hooks firing during staged_files_only

This commit is contained in:
Dom 2020-03-20 15:48:44 +00:00 committed by Anthony Sottile
parent 0670e0b287
commit 928938a6a1
5 changed files with 53 additions and 5 deletions

View file

@ -324,6 +324,12 @@ def run(
f'`--hook-stage {args.hook_stage}`',
)
return 1
# prevent recursive post-checkout hooks (#1418)
if (
args.hook_stage == 'post-checkout' and
environ.get('_PRE_COMMIT_SKIP_POST_CHECKOUT')
):
return 0
# Expose from-ref / to-ref as environment variables for hooks to consume
if args.from_ref and args.to_ref: