]> git.ozlabs.org Git - next-scripts/commitdiff
check_fixes: try harder to find a valid SHA1
authorStephen Rothwell <sfr@canb.auug.org.au>
Sun, 27 Jan 2019 22:23:18 +0000 (09:23 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sun, 27 Jan 2019 22:23:18 +0000 (09:23 +1100)
Some people put "commit" before the SHA1

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
check_fixes

index 79c82a5021b93438a65bce47612dcef846d67580..29a204dbded83fc7098286dcd2e4240384f40096 100755 (executable)
@@ -12,7 +12,9 @@ fi
 
 # This should be a git tree that contains *only* Linus' tree
 Linus_tree="${HOME}/kernels/linus.git"
-split_re='^([[:xdigit:]]+)[[:space:]]*(.*)$'
+split_re1='^([[:xdigit:]]{5,})[[:space:]]+(.*)$'
+split_re2='^([[:xdigit:]]{5,})[[:space:]]*(.*)$'
+split_re3='^([Cc][Oo][Mm][Mm][Ii][Tt])[[:space:]]*([[:xdigit:]]{5,})[[:space:]]*(.*)$'
 nl=$'\n'
 
 # Strip the leading and training spaces from a string
@@ -47,10 +49,21 @@ has these problem(s):
                sha=
                subject=
                msg=
-               [[ "$f" =~ $split_re ]]
+               [[ "$f" =~ $split_re1 ]]
                sha="${BASH_REMATCH[1]}"
                subject="${BASH_REMATCH[2]}"
 
+               if [ -z "$sha" ]; then
+                       [[ "$f" =~ $split_re2 ]]
+                       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"
+                       fi
+               fi
                if [ -z "$sha" ]; then
                        printf '%s%s  - %s\n' "$commit_msg" "$fixes_msg" 'No SHA1 recognised'
                        commit_msg=''