diff --git a/bin/commitlint b/bin/commitlint index cd4a096a5..2c5fe4cd4 100755 --- a/bin/commitlint +++ b/bin/commitlint @@ -53,19 +53,25 @@ function checkmsg() SUMMARY=$(echo "$MSG" | head -1) FMT="%s%-60s %b${NRM}\n" + # Is this some boring commit, eg a hard-to avoid github merge commit ? + # Ignore those. + if echo "$SUMMARY" | grep -qE '^Merge \w{40} into \w{40}' + then + # shellcheck disable=SC2059 + printf "$FMT" "$HASH" "$SUMMARY" "[ignored]" # Does the summary follow convention ? # [;]type[!]: [topic: [subtopic: ...]] subject - # # spaces after ; and ! and : are optional (also before, but that should be discouraged) # the type prefix is required and must be all word characters # there can be zero or more topic prefixes of increasing depth # a topic prefix must begin with a word character, can contain spaces/slashes/commas # (so potentially multiple topic labels, eg "imp: bs, cf, is: cli/doc: blah blah") - if ! echo "$SUMMARY" | grep -qE '^( *; *)?\w+( *!)? *: *(\w[\w,/ ]* *: *)*' + elif ! echo "$SUMMARY" | grep -qE '^( *; *)?\w+( *!)? *: *(\w[\w,/ ]* *: *)*' then # shellcheck disable=SC2059 printf "$FMT" "$HASH" "$SUMMARY" "${RED}[FAIL]" STATUS=1 + # Looks like a good commit. else # shellcheck disable=SC2059 printf "$FMT" "$HASH" "$SUMMARY" "${GRN}[ok]"