From: Nelio Laranjeiro <nelio.laranje...@6wind.com> A driver patch under net should start with "net/<driver name>" 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 <nelio.laranjeiro at 6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com> --- v2: - fix capture in bad variable - ignore doc/ and config/ --- 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 833aa39..21f1055 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/<driver name> +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.7.0