mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
fix: catch missing arg if using {prepare-}commit-msg stage
If using the prepare-commit-msg and commit-msg stages specifically (such
as with the try-repo command), the `--commit-msg-filename` arg must be
provided.
[fixes #1336]
chore: improve error message for hook stage check
This commit is contained in:
parent
1c641b1c28
commit
5258dce73b
2 changed files with 20 additions and 8 deletions
|
|
@ -306,6 +306,15 @@ def run(
|
|||
f'`git add {config_file}` to fix this.',
|
||||
)
|
||||
return 1
|
||||
if (
|
||||
args.hook_stage in {'prepare-commit-msg', 'commit-msg'} and
|
||||
not args.commit_msg_filename
|
||||
):
|
||||
logger.error(
|
||||
f'`--commit-msg-filename` is required for '
|
||||
f'`--hook-stage {args.hook_stage}`',
|
||||
)
|
||||
return 1
|
||||
|
||||
# Expose origin / source as environment variables for hooks to consume
|
||||
if args.origin and args.source:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue