Skip to content
Open
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: 6 additions & 2 deletions hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ validate_commit_message() {
# 3. Capitalize the subject line
# ------------------------------------------------------------------------------

[[ ${COMMIT_SUBJECT} =~ ^[[:blank:]]*([[:upper:]]{1}[[:lower:]]*|[[:digit:]]+)([[:blank:]]|[[:punct:]]|$) ]]
test $? -eq 0 || add_warning 1 "Capitalize the subject line"
SUBJECT_AFTER_PREFIX=${COMMIT_SUBJECT}
if [[ ${COMMIT_SUBJECT} =~ ^[[:blank:]]*[[:alpha:]]+('('[^')']*')')?:[[:blank:]]*(.*) ]]; then
SUBJECT_AFTER_PREFIX=${BASH_REMATCH[2]}
fi
[[ ${SUBJECT_AFTER_PREFIX} =~ ^[[:blank:]]*([[:upper:]]{1}[[:lower:]]*|[[:digit:]]+)([[:blank:]]|[[:punct:]]|$) ]]
test $? -eq 0 || add_warning 1 "Capitalize the subject line (after prefix)"

# 4. Do not end the subject line with a period
# ------------------------------------------------------------------------------
Expand Down