You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon testing, $1 always seems to evaluate to .git/COMMIT_EDITMSG (which is also the default value for commitlint -e). Although I have read sources that say $1 evaluates to the commit message itself (rather than a file path containing it), I have not found that to be the case, which I confirmed with the Git hooks docs:
It takes a single parameter, the name of the file that holds the proposed commit log message.
Is there an edge case where $1 evaluates to a different path that this is trying to handle? Or can it be safely omitted?
This is more of a question than a bug report, but can be actionable depending on discussion.
The README provides instructions on how to setup commitlint with husky. I'm curious if passing in
$1
is actually necessary here:npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
Upon testing,
$1
always seems to evaluate to.git/COMMIT_EDITMSG
(which is also the default value forcommitlint -e
). Although I have read sources that say$1
evaluates to the commit message itself (rather than a file path containing it), I have not found that to be the case, which I confirmed with the Git hooks docs:Is there an edge case where
$1
evaluates to a different path that this is trying to handle? Or can it be safely omitted?Also, I don't think this recommended command will work in Bash because string interpolation isn't supported in single-quotes:
I'm wondering if this appears to work because it silently falls back to using
.git/COMMIT_EDITMSG
.I made a test with the following commit hook to confirm:
Result:
Is this for a specific non-Bash environment?
The text was updated successfully, but these errors were encountered: