Skip to content

Commit

Permalink
style: Fixed styling for commit message hook (#21)
Browse files Browse the repository at this point in the history
Recommended way is command <
Regex needs to be quoted to prevent glob spliting
  • Loading branch information
seebeen authored Sep 28, 2023
1 parent 536b3c2 commit 458d52c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -z "$1" ]; then
exit 1
fi

commitTitle="$(cat $1 | head -n1)"
commitTitle="$(head -n 1 < "$1")"

# ignore merge
if echo "$commitTitle" | grep -qE "^Merge"; then
Expand All @@ -15,7 +15,7 @@ fi

# check commit message
REGEX='^(feat|fix|docs|style|refactor|ci|test|chore|comment)\(.*\)\:.*'
if ! echo "$commitTitle" | grep -qE ${REGEX}; then
if ! echo "$commitTitle" | grep -qE "${REGEX}"; then
echo "Your commit title '$commitTitle' did not follow conventional commit message rules:"
echo "Please comply with the regex ${REGEX}"
exit 1
Expand Down

0 comments on commit 458d52c

Please sign in to comment.