[dpdk-dev] [PATCH] devtools: check commit log fixes syntax
Thomas Monjalon
thomas at monjalon.net
Tue Jan 29 21:41:42 CET 2019
29/01/2019 16:30, Ferruh Yigit:
> Fixes line commit id length defined as 12 in fixline alias:
> fixline = log -1 --abbrev=12 --format='Fixes: %h (\"%s\")%nCc: %ae'
>
> Check if the Fixes line commit id length matches the defined value.
This check was missing on purpose, in order to not be too strict.
I think it's OK if the length of the SHA1 is not always the same.
> --- a/devtools/check-git-log.sh
> +++ b/devtools/check-git-log.sh
> @@ -177,6 +177,11 @@ bad=$(for fixtag in $fixtags ; do
> done | sed 's,^,\t,')
> [ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n"
>
> +bad=$(for fixtag in $fixtags ; do
> + echo $fixtag | awk '{print $2}' | awk 'length != 12 {print}'
> +done)
> +[ -z "$bad" ] || printf "Wrong 'Fixes' syntax:\n$bad\n"
> +
> # check Cc: stable at dpdk.org for fixes
> bad=$(for fix in $stablefixes ; do
> git log --format='%b' -1 $fix | grep -qi '^Cc: *stable at dpdk.org' ||
If you really want to be that strict, it can be done simpler:
bad=$(for fixtag in $fixtags ; do
hash=$(echo "$fixtag" | sed 's,^Fixes: \([0-9a-f]*\).*,\1,')
if git branch --contains $hash 2>&- | grep -q '^\*' ; then
- good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-)
+ good=$(git log --abbrev=12 --format='Fixes: %h ("%s")' -1 $hash 2>&-)
else
good="reference not in current branch"
fi
More information about the dev
mailing list