-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
prepare-commit-msg hook stopped working with v9 #1432
Comments
What did you do to make it work? I have exactly the same issue... When I try to grep the contents of the $1 it breaks without telling anything else... This is the code I have in the prepare-commit-msg file in the .husky folder:
When you say that you choose another approach what are you referring to? Thanks in advance. |
@endika-campo Hey! If it's still relevant, you can add disabling the work on error before execution set +e # Disable completion on error
PREFIX_IN_COMMIT=$(grep -c "$PREFIX" "$1")
set -e # Enable it back This fixes the bug, but I don't think it's a very good solution. P.S. see also #1455 |
Context
When upgrading husky to version 9 my
prepare-commit-msg
hook stopped working (works fine with v8).The upgrade was done following the docs (also tried swapping
husky
withhusky install
in theprepare
script). I've also tried using the IDE as well as the terminal (which I restarted as well)The script fails with the following msg:
husky - prepare-commit-msg script failed (code 1)
here is the script: (I've also tried omitting the first line which had no effect)
I've debugged it so far as it will go to the line with the first
grep
command. But there it fails. Could it be that the$1
is not injected correctly? Reverting to v8 resolved the issue.The text was updated successfully, but these errors were encountered: