Closed
Description
Using the recommended husky commit message hook doesn't work with git gui
.
{
"scripts": {
"commitmsg": "conventional-changelog-lint -e"
}
}
The issue is that -e
assumes the commit message is at .git/COMMIT_EDITMSG
which is not always true.
git gui
for example places the commit message at .git/GITGUI_EDITMESSAGE
.
Looking at the sample commit-msg hook from Git it specifies that the location of the file containing the commit message is passed as first argument $1
.
To make this work I think there are two changes necessary:
- make
-e
accept an argument - change the husky hook to
"commitmsg": "conventional-changelog-lint -e $GIT_PARAMS"
Point two is required as husky doesn't pass the arguments directly but instead puts them into an environment variable GIT_PARAMS
.