# 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
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=''