From 555028f3d11c84fc8abebe358687e2a6cf873c2e Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Sun, 26 Jun 2016 21:54:02 +0900 Subject: [PATCH] test: more accurate checking of commit title --- test | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test b/test index 92c7b2e8a..c5dd77a32 100755 --- a/test +++ b/test @@ -149,18 +149,22 @@ function fmt_tests { echo "Checking commit titles..." git log master..HEAD --oneline | while read l; do - pfx=`echo "$l" | cut -f2 -d' '` - if [ "$pfx" == "Merge" ]; then + commitMsg=`echo "$l" | cut -f2- -d' '` + if [[ "$commitMsg" == Merge* ]]; then # ignore "Merge pull" commits continue fi - if [ "$pfx" == "Revert" ]; then + if [[ "$commitMsg" == Revert* ]]; then # ignore revert commits continue fi - if ! [[ "$pfx" =~ :$ ]]; then - echo "$pfx"... - echo "Expected commit title format ': '" + + pkgPrefix=`echo "$commitMsg" | cut -f1 -d':'` + spaceCommas=`echo "$commitMsg" | sed 's/ /\n/g' | grep -c ',$' || echo 0` + commaSpaces=`echo "$commitMsg" | sed 's/,/\n/g' | grep -c '^ ' || echo 0` + if [[ `echo $commitMsg | grep -c ":..*"` == 0 || "$commitMsg" == "$pkgPrefix" || "$spaceCommas" != "$commaSpaces" ]]; then + echo "$l"... + echo "Expected commit title format '{\", \"}: '" echo "Got: $l" exit 255 fi