-
-
Notifications
You must be signed in to change notification settings - Fork 278
Aborted Commit Considered to Fail Validation When Run As commit-msg Hook #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Kurt-von-Laven Hi, thanks for reporting! I'm a bit against this feature. Even though the commit is an empty one, it's still a git commit and should be checked. |
I get where you are coming from. Certainly that is more technically correct to check the commit message no matter what. To be clear, I am referring to empty commit messages as opposed to empty commits. My argument here is that the commit only goes through if the user explicitly requested that an empty commit message be allowed, and empirically I have never actually seen anyone push an empty commit message since typing |
Get your point now. if that's the case, I think it's a similar issue to #247. This feature sounds good to me 👍 |
as this issue is simliar to #247 , I'll close this one and let's discuss there |
Description
Git interprets an empty commit message to mean that a commit should be aborted, but calls all commit-msg hooks anyways. This causes pre-commit hooks that run as commit-msg hooks but don't guard against empty commit messages to spew errors en masse when the commit was already being intentionally aborted.
Steps to reproduce
touch foo && git add && git commit
For step 1, add the following to
.pre-commit-config.yaml
:Current behavior
Pre-commit follows git's lead and calls commitizen when the commit message is empty when run as a commit-msg hook. This leads to the following error:
The commit is still correctly aborted of course.
Desired behavior
I expected the commitizen commit-msg hook to silently report success in this case since there is no commit message to check.
Environment
The text was updated successfully, but these errors were encountered: