From: Stephen Rothwell Date: Sun, 27 Jan 2019 22:23:18 +0000 (+1100) Subject: check_fixes: try harder to find a valid SHA1 X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=d8479d605738b184bfd319669e70da1755f21bde;p=next-scripts check_fixes: try harder to find a valid SHA1 Some people put "commit" before the SHA1 Signed-off-by: Stephen Rothwell --- diff --git a/check_fixes b/check_fixes index 79c82a5..29a204d 100755 --- a/check_fixes +++ b/check_fixes @@ -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=''