Skip to content

Commit

Permalink
scripts/commitcheck.sh: fix false positive for signed commits
Browse files Browse the repository at this point in the history
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12105
  • Loading branch information
nabijaczleweli authored and behlendorf committed Jun 11, 2021
1 parent feb04e6 commit 10bcc4d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/commitcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ REF="HEAD"
test_commit_bodylength()
{
length="72"
body=$(git log -n 1 --pretty=%b "$REF" | grep -Ev "http(s)*://" | grep -E -m 1 ".{$((length + 1))}")
body=$(git log --no-show-signature -n 1 --pretty=%b "$REF" | grep -Ev "http(s)*://" | grep -E -m 1 ".{$((length + 1))}")
if [ -n "$body" ]; then
echo "error: commit message body contains line over ${length} characters"
return 1
Expand All @@ -20,7 +20,7 @@ test_commit_bodylength()
check_tagged_line()
{
regex='^[[:space:]]*'"$1"':[[:space:]][[:print:]]+[[:space:]]<[[:graph:]]+>$'
foundline=$(git log -n 1 "$REF" | grep -E -m 1 "$regex")
foundline=$(git log --no-show-signature -n 1 "$REF" | grep -E -m 1 "$regex")
if [ -z "$foundline" ]; then
echo "error: missing \"$1\""
return 1
Expand All @@ -35,7 +35,7 @@ new_change_commit()
error=0

# subject is not longer than 72 characters
long_subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '.{73}')
long_subject=$(git log --no-show-signature -n 1 --pretty=%s "$REF" | grep -E -m 1 '.{73}')
if [ -n "$long_subject" ]; then
echo "error: commit subject over 72 characters"
error=1
Expand All @@ -57,7 +57,7 @@ new_change_commit()
is_coverity_fix()
{
# subject starts with Fix coverity defects means it's a coverity fix
subject=$(git log -n 1 --pretty=%s "$REF" | grep -E -m 1 '^Fix coverity defects')
subject=$(git log --no-show-signature -n 1 --pretty=%s "$REF" | grep -E -m 1 '^Fix coverity defects')
if [ -n "$subject" ]; then
return 0
fi
Expand All @@ -70,7 +70,7 @@ coverity_fix_commit()
error=0

# subject starts with Fix coverity defects: CID dddd, dddd...
subject=$(git log -n 1 --pretty=%s "$REF" |
subject=$(git log --no-show-signature -n 1 --pretty=%s "$REF" |
grep -E -m 1 'Fix coverity defects: CID [[:digit:]]+(, [[:digit:]]+)*')
if [ -z "$subject" ]; then
echo "error: Coverity defect fixes must have a subject line that starts with \"Fix coverity defects: CID dddd\""
Expand All @@ -86,7 +86,7 @@ coverity_fix_commit()
OLDIFS=$IFS
IFS='
'
for line in $(git log -n 1 --pretty=%b "$REF" | grep -E '^CID'); do
for line in $(git log --no-show-signature -n 1 --pretty=%b "$REF" | grep -E '^CID'); do
if ! echo "$line" | grep -qE '^CID [[:digit:]]+: ([[:graph:]]+|[[:space:]])+ \(([[:upper:]]|\_)+\)'; then
echo "error: commit message has an improperly formatted CID defect line"
error=1
Expand Down

0 comments on commit 10bcc4d

Please sign in to comment.