-
Notifications
You must be signed in to change notification settings - Fork 64
Description
When git's commit hooks run, they go in the order pre-commit, prepare-commit-msg, commit-msg. This project runs linting and testing during pre-commit and commitlint during commit-msg. If you make a mistake in the commit message, like using too many characters, you have to wait for linting and the entire test suite to run before you find out.
There is no altering the order of commit hooks and you only receive the commit message as an argument during the commit-msg hook.
I propose that all pre commit scripts are run as part of the commit-msg hook with the commitlint script first, followed by linting and testing the project. This will allow for invalid commit messages to exit the commit early while retaining all the previous behaviour.
I don't know of any downsides to using the commit-msg hook for this. It's not how the git docs describe the usage of commit-msg and pre-commit but it would save me (and hopefully other contributors) time when I inevitable make a mistake in the commit message.
Thoughts?