mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Expose hook stage to hook scripts as env var
This change makes it possible for one hook script to run in several stages and change its behavior based on context.
This commit is contained in:
parent
cb40e9682e
commit
ea61a9cff1
1 changed files with 3 additions and 0 deletions
|
|
@ -391,6 +391,9 @@ def run(
|
|||
if args.rewrite_command:
|
||||
environ['PRE_COMMIT_REWRITE_COMMAND'] = args.rewrite_command
|
||||
|
||||
if args.hook_stage:
|
||||
environ['PRE_COMMIT_HOOK_STAGE'] = args.hook_stage
|
||||
|
||||
# Set pre_commit flag
|
||||
environ['PRE_COMMIT'] = '1'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue