[dpdk-dev] [PATCH] devtools: check commit log fixes syntax
David Marchand
david.marchand at redhat.com
Tue Jan 29 18:34:07 CET 2019
On Tue, Jan 29, 2019 at 4:31 PM Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> 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.
>
Can't git decide to report a longer string in case of collisions of
abbreviated id ?
Tried this for 2 characters, and git forcefully reported 5 chars:
$ git log -1 --abbrev=2 origin/master --format='Fixes: %h (\"%s\")'
Fixes: a2f9c (\"version: 19.02-rc4\")
I did not find any collisions with 12 characters abbreviated commitid, but
I am not sure enforcing the check on exactly 12 characters is a good idea
in the long run.
> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
> ---
> Cc: Qi Zhang <qi.z.zhang at intel.com>
> ---
> devtools/check-git-log.sh | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh
> index d39064f9d..f4d6c1fba 100755
> --- 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)
>
Not an awk expert (this could be done in pure shell, but this is a
different story :-p), but I would see something like:
for fixtag in $fixtags; do
echo $fixtag | awk 'length($2) < 12 { print $2 }';
done
--
David Marchand
More information about the dev
mailing list