3 KNOWN_FEATURES=$(cat MAINTAINERS | sed -ne 's/^I:[[:space:]]*//p')
4 FEATURES=$(git show -s --format=%s --no-color | sed -e 's/\([a-z0-9 -]*\):.*/\1/')
5 KNOWN_TYPES="feature fix refactor style docs test make"
6 TYPE=$(git show -s --format=%b --no-color | sed -ne 's/^Type:[[:space:]]*//p')
7 ERR="=============================== ERROR ==============================="
9 # Chech that subject line contains at least one feature id
10 if [ $(echo ${FEATURES} | wc -w) -eq 0 ]; then
12 echo "git commit 'Subject:' line must contain at least one known feature id."
13 echo "feature id(s) must be listed before ':' and space delimited "
14 echo "if more then one is listed."
15 echo "Please refer to the MAINTAINERS file (I: lines) for known feature ids."
20 # Check that feature ids in subject line are known
21 for i in ${FEATURES}; do
23 for j in ${KNOWN_FEATURES}; do
24 [ "${i}" = "${j}" ] && is_known=true
26 if [ ${is_known} = "false" ] ; then
28 echo "Unknown feature '${i}' in commit 'Subject:' line."
29 echo "Feature must exist in MAINTAINERS file. If this commit introduces "
30 echo "a new feature, then this commit must add an entry to the "
31 echo "MAINTAINERS file."
37 # Check that Message body contains valid Type: entry
39 for i in ${KNOWN_TYPES}; do
40 [ "${i}" = "${TYPE}" ] && is_known=true
42 if [ ${is_known} = "false" ] ; then
44 echo "Unknown commit type '${TYPE}' in commit message body."
45 echo "Commit message must contain known 'Type:' entry."
46 echo "Known types are: ${KNOWN_TYPES}"
50 echo "*******************************************************************"
51 echo "* VPP Commit Message Checkstyle Successfully Completed"
52 echo "*******************************************************************"