Skip to content

Commit ef3fd3b

Browse files
committed
Ignore spell of indented lines in commit messages
This enables indenting lines to quote snippets of code, output of programs, etc. in commit messages. Previously, those are often rejected by aspell due to bad spelling. Closes: #290 Change-Id: Ib32034632ad75c78c9ccd1b02586b3a055c4228e
1 parent 16079c8 commit ef3fd3b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/commit-msg.hook

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ read_commit_message() {
8585
REPLY="${REPLY%%*( )}"
8686
shopt -u extglob
8787

88-
# ignore comments
89-
[[ $REPLY =~ ^# ]]
88+
# ignore comments and indented lines
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.
@@ -452,7 +452,7 @@ validate_commit_message() {
452452
candidate="${BASH_REMATCH[2]}"
453453
# Only warn if the candidate filename ends with .c or .h
454454
if [[ "$candidate" =~ \.(c|h)$ ]]; then
455-
add_warning 1 "Avoid using just a filename like '$candidate'. Provide a functional, meaningful description"
455+
add_warning 1 "Avoid using just a filename like '$candidate'. Provide a functional, meaningful description"
456456
fi
457457
fi
458458

0 commit comments

Comments
 (0)