From: Stephen Rothwell Date: Sun, 27 Jan 2019 23:06:43 +0000 (+1100) Subject: check_fixes: catch empty subjects X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=a3ef99805ca99d3ddfa5548e679d507fad16a7a0;p=next-scripts check_fixes: catch empty subjects --- diff --git a/check_fixes b/check_fixes index 29a204d..593b735 100755 --- a/check_fixes +++ b/check_fixes @@ -49,20 +49,22 @@ has these problem(s): sha= subject= msg= - [[ "$f" =~ $split_re1 ]] - sha="${BASH_REMATCH[1]}" - subject="${BASH_REMATCH[2]}" - - if [ -z "$sha" ]; then - [[ "$f" =~ $split_re2 ]] + if [[ "$f" =~ $split_re1 ]]; then + sha="${BASH_REMATCH[1]}" + subject="${BASH_REMATCH[2]}" + elif [[ "$f" =~ $split_re2 ]]; then sha="${BASH_REMATCH[1]}" subject="${BASH_REMATCH[2]}" - if [ -z "$sha" ]; then - [[ "$f" =~ $split_re3 ]] - sha="${BASH_REMATCH[2]}" - subject="${BASH_REMATCH[3]}" - msg="${msg:+${msg}${nl}} - leading word '${BASH_REMATCH[1]}' unexpected" + msg="${msg:+${msg}${nl}} - " + if [ -z "$subject" ]; then + msg+="missing subject" + else + msg+="missing space between the SHA1 and the subject" fi + elif [[ "$f" =~ $split_re3 ]]; then + sha="${BASH_REMATCH[2]}" + subject="${BASH_REMATCH[3]}" + msg="${msg:+${msg}${nl}} - leading word '${BASH_REMATCH[1]}' unexpected" fi if [ -z "$sha" ]; then printf '%s%s - %s\n' "$commit_msg" "$fixes_msg" 'No SHA1 recognised'