2016-07-06 13:59, N?lio Laranjeiro:
> > +# 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/')" ] || continue
> > +   driversgrp=$(echo "$files" | cut -d "/" -f 2 | sort -u)
> > +   drivers=$(echo "$files" | cut -d "/" -f 2,3 | sort -u)
> > +   if [ $(echo "$driversgrp" | wc -l) -gt 1 ] ; then
> > +           bad=$(echo "$headline" | grep -v '^drivers:')
> 
> I think you forgot the '$' for drivers in the line just above.

No it is a plain "drivers:" for cases where we have net and crypto.
(it is an addition from your original idea)
But I forgot to remove bad=$( which I've moved to the first line.

> > +   elif [ $(echo "$drivers" | wc -l) -gt 1 ] ; then
> > +           bad=$(echo "$headline" | grep -v "^$driversgrp")
> > +   else
> > +           bad=$(echo "$headline" | grep -v "^$drivers")
> > +   fi
> > +done | sed 's,^,\t,')
> > +[ -z "$bad" ] || printf "Wrong headline prefix:\n$bad\n"
> 
> Otherwise it seems good.

V2 on going

Reply via email to