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:
Michael Vincent 2021-11-08 11:03:56 -06:00
parent cb40e9682e
commit ea61a9cff1

View file

@ -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'