aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/check-git-log.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/check-git-log.sh')
-rwxr-xr-xscripts/check-git-log.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/scripts/check-git-log.sh b/scripts/check-git-log.sh
index ce6c15ea..7d2c7ee8 100755
--- a/scripts/check-git-log.sh
+++ b/scripts/check-git-log.sh
@@ -55,7 +55,7 @@ tags=$(git log --format='%b' $range | grep -i -e 'by *:' -e 'fix.*:')
fixes=$(git log --format='%h %s' $range | grep -i ': *fix' | cut -d' ' -f1)
# check headline format (spacing, no punctuation, no code)
-bad=$(echo "$headlines" | grep \
+bad=$(echo "$headlines" | grep --color=always \
-e ' ' \
-e '^ ' \
-e ' $' \
@@ -69,7 +69,7 @@ bad=$(echo "$headlines" | grep \
[ -z "$bad" ] || printf "Wrong headline format:\n$bad\n"
# check headline label for common typos
-bad=$(echo "$headlines" | grep \
+bad=$(echo "$headlines" | grep --color=always \
-e '^example[:/]' \
-e '^apps/' \
-e '^testpmd' \
@@ -79,15 +79,15 @@ bad=$(echo "$headlines" | grep \
[ -z "$bad" ] || printf "Wrong headline label:\n$bad\n"
# check headline lowercase for first words
-bad=$(echo "$headlines" | grep \
+bad=$(echo "$headlines" | grep --color=always \
-e '^.*[A-Z].*:' \
-e ': *[A-Z]' \
| sed 's,^,\t,')
[ -z "$bad" ] || printf "Wrong headline uppercase:\n$bad\n"
# check headline uppercase (Rx/Tx, VF, L2, MAC, Linux, ARM...)
-bad=$(echo "$headlines" | grep \
- -e 'rx\|tx\|RX\|TX' \
+bad=$(echo "$headlines" | grep -E --color=always \
+ -e '\<(rx|tx|RX|TX)\>' \
-e '\<[pv]f\>' \
-e '\<l[234]\>' \
-e ':.*\<dma\>' \
@@ -111,9 +111,15 @@ bad=$(echo "$headlines" | awk 'length>60 {print}' | sed 's,^,\t,')
[ -z "$bad" ] || printf "Headline too long:\n$bad\n"
# check body lines length (75 max)
-bad=$(echo "$bodylines" | awk 'length>75 {print}' | sed 's,^,\t,')
+bad=$(echo "$bodylines" | grep -v '^Fixes:' | awk 'length>75 {print}' | sed 's,^,\t,')
[ -z "$bad" ] || printf "Line too long:\n$bad\n"
+# check starting commit message with "It"
+bad=$(echo "$bodylines" | head -n1 | grep -E --color=always \
+ -ie '^It ' \
+ | sed 's,^,\t,')
+[ -z "$bad" ] || printf "Wrong beginning of commit message:\n$bad\n"
+
# check tags spelling
bad=$(echo "$tags" |
grep -v '^\(Reported\|Suggested\|Signed-off\|Acked\|Reviewed\|Tested\)-by: [^,]* <.*@.*>$' |
@@ -134,7 +140,11 @@ IFS='
fixtags=$(echo "$tags" | grep '^Fixes: ')
bad=$(for fixtag in $fixtags ; do
hash=$(echo "$fixtag" | sed 's,^Fixes: \([0-9a-f]*\).*,\1,')
- good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-)
+ if git branch --contains $hash | grep -q '^\*' ; then
+ good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-)
+ else
+ good="reference not in current branch"
+ fi
printf "$fixtag" | grep -v "^$good$"
done | sed 's,^,\t,')
[ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n"