fix(husky): quote parameter in commit-msg hook to support inline commits#640
Merged
fix(husky): quote parameter in commit-msg hook to support inline commits#640
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the commit-msg hook to properly handle inline commit messages when using git commit -m. The issue occurred because the hook parameter wasn't properly quoted, causing problems with file paths containing spaces or special characters.
Key Changes:
- Updated the husky commit-msg hook to quote the
$1parameter, ensuring proper handling of file paths passed by Git
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dorsha
approved these changes
Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #639
View workflow run
Perfect! Everything is clean now. Let me provide a summary of the fix:
Summary
I successfully fixed the commit hook failure issue when using
git commit -mwith inline messages.The Problem
When Shuni's
action/lib/git.tsrunsgit commit -m "${message}", it triggers the huskycommit-msghook in the node-sdk repository. The hook was calling:npx --no -- commitlint --edit ${1}The unquoted
${1}parameter could cause issues with:The Solution
Updated
.husky/commit-msgto properly quote the parameter:npx --no -- commitlint --edit "$1"This ensures that:
git commit -m "message") - Git creates a temporary file with the message and passes its path as$1git commitwithout-m) - Git uses.git/COMMIT_EDITMSGand passes its path as$1Testing
The fix was tested and verified:
git commit -m "fix: support git commit -m with commitlint hook"git commit -m "invalid commit message"The change is minimal (adding quotes around
$1) but critical for supporting both interactive and inline commit modes.Created by Shuni 🐕