From e757070d64ff0531f89f311de4b2bbd3f8251f3f Mon Sep 17 00:00:00 2001 From: Nelio Laranjeiro Date: Wed, 29 Jun 2016 17:55:08 +0200 Subject: [PATCH] scripts: check headline of drivers commits A driver patch under net should start with "net/" or if a patch touch multiple drivers, it should only start with "net:". The same apply for crypto. A patch touching all drivers (net + crypto) should start with "drivers:". Longer prefixes like "net/mlx:" (for mlx4/mlx5) or "net/e1000/base:" are handled by not checking the colon. The directories doc/ and config/ are ignored because a driver patch can modify them. Signed-off-by: Nelio Laranjeiro Signed-off-by: Thomas Monjalon --- scripts/check-git-log.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/check-git-log.sh b/scripts/check-git-log.sh index 035acf688b..8a7ddbd7ca 100755 --- a/scripts/check-git-log.sh +++ b/scripts/check-git-log.sh @@ -70,6 +70,24 @@ bad=$(echo "$headlines" | grep --color=always \ | sed 's,^,\t,') [ -z "$bad" ] || printf "Wrong headline format:\n$bad\n" +# check headline prefix when touching only drivers, e.g. net/ +bad=$(for commit in $commits ; do + headline=$(git log --format='%s' -1 $commit) + files=$(git diff-tree --no-commit-id --name-only -r $commit) + [ -z "$(echo "$files" | grep -v '^\(drivers\|doc\|config\)/')" ] || + continue + drv=$(echo "$files" | grep '^drivers/' | cut -d "/" -f 2,3 | sort -u) + drvgrp=$(echo "$drv" | cut -d "/" -f 1 | uniq) + if [ $(echo "$drvgrp" | wc -l) -gt 1 ] ; then + echo "$headline" | grep -v '^drivers:' + elif [ $(echo "$drv" | wc -l) -gt 1 ] ; then + echo "$headline" | grep -v "^$drvgrp" + else + echo "$headline" | grep -v "^$drv" + fi +done | sed 's,^,\t,') +[ -z "$bad" ] || printf "Wrong headline prefix:\n$bad\n" + # check headline label for common typos bad=$(echo "$headlines" | grep --color=always \ -e '^example[:/]' \ -- 2.20.1