Skip to content
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

--no-verify to bypass is not currently working... #137

Closed
FJunior225 opened this issue Jun 13, 2017 · 4 comments
Closed

--no-verify to bypass is not currently working... #137

FJunior225 opened this issue Jun 13, 2017 · 4 comments

Comments

@FJunior225
Copy link
Contributor

Hello,

I am creating a custom prepare-commit-msg hook that appends an ID to the commit msg. If no ID is found within the message or branch name, I log an error and exit(1). I exit(1) because I do not want to permit someone to commit a message without an ID. For some unknown reason, --no-verify does not bypass the commit message if an error occurs. I was hoping someone here can assist...

fj/test-prepare ✗
▶ git commit -m "remove test." --no-verify

> husky - npm run -s preparecommitmsg

No JIRA ID found. Skipping prepend.

> husky - prepare-commit-msg hook failed (add --no-verify to bypass)
> husky - to debug, use 'npm run preparecommitmsg'

The script within the project I am adding a commit has the following in the package.json:
"preparecommitmsg": "node node_modules/***/src/preparecommitmsg-hook.js"

@alexeyten
Copy link
Contributor

alexeyten commented Jun 14, 2017

commit-msg hook better suits your needs.

https://git-scm.com/docs/githooks

prepare-commit-msg
[...]
The purpose of the hook is to edit the message file in place, and it is not suppressed by the --no-verify option.

commit-msg
[...] can be bypassed with the --no-verify option.
[...] It can also be used to refuse the commit after inspecting the message file.

@FJunior225
Copy link
Contributor Author

@alexeyten that makes sense - is it possible to update Husky to not show husky - prepare-commit-msg hook failed (add --no-verify to bypass) message for prepare-commit-msg hook? Because if I am reading that correctly, --no-verify will have no impact on the hook and showing that message may be misleading.

@typicode
Copy link
Owner

@alexeyten @FJunior225 very good point, I'll add it in the next release 👍
Thank you :)

@typicode
Copy link
Owner

Fixed in v0.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants