From 6823ca50765437c96cc2a6912cd7f5efe98a5e26 Mon Sep 17 00:00:00 2001 From: haoadoreorange Date: Sat, 30 May 2026 10:27:37 -0400 Subject: [PATCH] fix(hook): Support conventional commit Signed-off-by: haoadoreorange --- hook.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hook.sh b/hook.sh index 0cc1bc5..d24d4b8 100755 --- a/hook.sh +++ b/hook.sh @@ -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 # ------------------------------------------------------------------------------