mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Add PRE_COMMIT_ALL_FILES environment variable
Add a `PRE_COMMIT_ALL_FILES` environment variable to allow hooks to determine if pre-commit was called with `--all-files`. This can be useful if different behavior is desired when running pre-commit over all files vs only staged files.
This commit is contained in:
parent
7858ad066f
commit
e03b5eb218
2 changed files with 12 additions and 0 deletions
|
|
@ -387,6 +387,9 @@ def run(
|
|||
|
||||
if args.rewrite_command:
|
||||
environ['PRE_COMMIT_REWRITE_COMMAND'] = args.rewrite_command
|
||||
|
||||
if args.all_files:
|
||||
environ['PRE_COMMIT_ALL_FILES'] = '1' if args.all_files else ''
|
||||
|
||||
# Set pre_commit flag
|
||||
environ['PRE_COMMIT'] = '1'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue