Skip to content

Ignore spell of indented lines in commit messages #291

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 1 commit into from
Apr 16, 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
8 changes: 4 additions & 4 deletions scripts/commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ read_commit_message() {
REPLY="${REPLY%%*( )}"
shopt -u extglob

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

Expand Down
Loading