9 if ! curl --output /dev/null --max-time 60 \
10 --silent --head --fail "$url" ; then
11 echo "\"$url\" is unreachable"
18 # check for a tagged line
19 function check_tagged_line()
21 regex='^\s*'"$1"':\s[[:print:]]+\s<[[:graph:]]+>$'
22 foundline=$(git log -n 1 "$REF" | egrep -m 1 "$regex")
23 if [ -z "$foundline" ]; then
24 echo "error: missing \"$1\""
31 # check for a tagged line and check that the link is valid
32 function check_tagged_line_with_url ()
34 regex='^\s*'"$1"':\s\K([[:graph:]]+)$'
35 foundline=$(git log -n 1 "$REF" | grep -Po "$regex")
36 if [ -z "$foundline" ]; then
37 echo "error: missing \"$1\""
41 if ! test_url "$foundline"; then
48 # check commit message for a normal commit
49 function new_change_commit()
53 # subject is not longer than 50 characters
54 long_subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '.{51}')
55 if [ -n "$long_subject" ]; then
56 echo "error: commit subject over 50 characters"
60 # need a signed off by
61 if ! check_tagged_line "Signed-off-by" ; then
65 # ensure that no lines in the body of the commit are over 72 characters
66 body=$(git log -n 1 --pretty=%b "$REF" | egrep -m 1 '.{73}')
67 if [ -n "$body" ]; then
68 echo "error: commit message body contains line over 72 characters"
75 function is_openzfs_port()
77 # subject starts with OpenZFS means it's an openzfs port
78 subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^OpenZFS')
79 if [ -n "$subject" ]; then
86 function openzfs_port_commit()
88 # subject starts with OpenZFS dddd
89 subject=$(git log -n 1 --pretty=%s "$REF" | egrep -m 1 '^OpenZFS [[:digit:]]+ - ')
90 if [ -z "$subject" ]; then
91 echo "OpenZFS patch ports must have a summary that starts with \"OpenZFS dddd - \""
95 # need an authored by line
96 if ! check_tagged_line "Authored by" ; then
100 # need a reviewed by line
101 if ! check_tagged_line "Reviewed by" ; then
105 # need a approved by line
106 if ! check_tagged_line "Approved by" ; then
110 # need ported by line
111 if ! check_tagged_line "Ported-by" ; then
115 # need a url to openzfs commit and it should be valid
116 if ! check_tagged_line_with_url "OpenZFS-commit" ; then
120 # need a url to illumos issue and it should be valid
121 if ! check_tagged_line_with_url "OpenZFS-issue" ; then
132 # if openzfs port, test against that
133 if is_openzfs_port; then
134 if ! openzfs_port_commit ; then
141 # have a normal commit
142 if ! new_change_commit ; then