]> git.ozlabs.org Git - next-scripts/commitdiff
check_fixes: catch empty subjects
authorStephen Rothwell <sfr@canb.auug.org.au>
Sun, 27 Jan 2019 23:06:43 +0000 (10:06 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sun, 27 Jan 2019 23:06:43 +0000 (10:06 +1100)
check_fixes

index 29a204dbded83fc7098286dcd2e4240384f40096..593b735f3c9a0ded903b3070d8811c1f799949a9 100755 (executable)
@@ -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'