Skip to content

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

Closed
@bachp

Description

@bachp

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions