Skip to content

Commit d4d5f11

Browse files
authored
Merge pull request #294 from lumynou5/commit-msg
Fix the commit message hook
2 parents 0b6f831 + 7ffda90 commit d4d5f11

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/commit-msg.hook

+4-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ read_commit_message() {
8686
shopt -u extglob
8787

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

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

214214
# Append standalone trailer keys.
@@ -483,7 +483,8 @@ validate_commit_message() {
483483

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

489490
# Use aspell to list misspelled words according to American English, ignoring quoted text.

0 commit comments

Comments
 (0)