mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
fix hooks firing during staged_files_only
This commit is contained in:
parent
0670e0b287
commit
928938a6a1
5 changed files with 53 additions and 5 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue