Skip to content

Fix the commit message hook #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scripts/commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ read_commit_message() {
shopt -u extglob

# ignore comments and indented lines
[[ $REPLY =~ ^(#|[ ][ ]) ]]
[[ $REPLY =~ ^(#| ) ]]
test $? -eq 0 || COMMIT_MSG_LINES+=("$REPLY")

[[ $REPLY =~ "# ------------------------ >8 ------------------------" ]]
Expand Down Expand Up @@ -208,7 +208,7 @@ build_commit_trailer_regex() {
TRAILER_REGEX+="$each|"
done
# Remove the trailing pipe, then add a separator and blank space pattern.
TRAILER_REGEX="${TRAILER_REGEX%|})[$separators][[:blank:]]*"
TRAILER_REGEX="${TRAILER_REGEX%|})[$separators][[:blank:]]*)"
fi

# Append standalone trailer keys.
Expand Down Expand Up @@ -483,7 +483,8 @@ validate_commit_message() {

MSG_FOR_SPELLCHECK_LINE_FINDING=$(echo "$FULL_COMMIT_MSG_WITH_SPACE" | sed -E \
-e "s/(['\"][^'\"]*['\"])//g" \
-e "s/\bcommit[[:space:]]+[0-9a-fA-F]{7,40}\b/commit/g")
-e "s/\bcommit[[:space:]]+[0-9a-fA-F]{7,40}\b/commit/g" \
-e "/^ /d")
MSG_FOR_SPELLCHECK=$(echo "$MSG_FOR_SPELLCHECK_LINE_FINDING" | sed '/^[[:space:]]*$/d')

# Use aspell to list misspelled words according to American English, ignoring quoted text.
Expand Down
Loading