git-conventional-commits
git-conventional-commits copied to clipboard
git-conventional-commits init [options] doesn't include [options] in commit-msg hook
When calling git-conventional-commits init [options] in a new repository, the options are not appended to the generated commit message hook.
For example:
In an empty repo I use git-conventional-commits init -c ./.git-conventional-commits.yaml, as I want my config file to be a hidden file.
The commit message hook the command generates looks like this:
#!/bin/sh
if command -v git-conventional-commits > /dev/null 2>&1
then
# fix for windows systems
PATH="/c/Program Files/nodejs:$HOME/AppData/Roaming/npm/:$PATH"
git-conventional-commits commit-msg-hook "$1"
fi
I would expect it to look like this:
#!/bin/sh
if command -v git-conventional-commits > /dev/null 2>&1
then
# fix for windows systems
PATH="/c/Program Files/nodejs:$HOME/AppData/Roaming/npm/:$PATH"
git-conventional-commits commit-msg-hook "$1" -c ./.git-conventional-commits.yaml #Appended args here.
fi
It seems that this should also happen if .pre-commit-config.yaml exists in the repo and defines the args: option.
Good point.
What do you mean by
It seems that this should also happen if .pre-commit-config.yaml exists in the repo and defines the args: option.
It's not core to this issue to be honest. But I was just previously adding the commit-msg hook with pre-commit using the following config:
repos:
- repo: https://github.com/qoomon/git-conventional-commits
rev: v2.6.7
hooks:
- id: conventional-commits
args: ['-c', '.git-conventional-commits.yaml']
But now that I think about it, being able to install the hook with both pre-commit and git-conventional-commits init doesn't make sense.