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

Message Commit hook doesn't work with git gui #40

Closed
2 tasks
bachp opened this issue Jul 6, 2017 · 3 comments
Closed
2 tasks

Message Commit hook doesn't work with git gui #40

bachp opened this issue Jul 6, 2017 · 3 comments

Comments

@bachp
Copy link

bachp commented Jul 6, 2017

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:

  1. make -e accept an argument
  2. 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.

@marionebl
Copy link
Contributor

Thanks for raising this @bachp.

We should implement this in a non-breaking fashion by defaulting to .git/COMMIT_EDITMSG if no argument is passed to -e.

Your suggested changes make a lot of sense – a PR would be very welcome if you'd like to contribute.

@bachp
Copy link
Author

bachp commented Jul 13, 2017

I found another way to make it work: conventional-changelog-lint < $1
In case somebody needs this until I'm able to do a MR.

@marionebl
Copy link
Contributor

marionebl commented Oct 14, 2017

bpedersen pushed a commit to bpedersen/commitlint that referenced this issue Oct 15, 2019
* chore: adds actions

* chore: updates workflow

* chore: leave node 12 placeholder

* chore: leave node 12 placeholder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants