From: Jean Privat Date: Wed, 19 Aug 2015 06:55:53 +0000 (-0400) Subject: jenkins: improve checksignedoffby to be more explicit and friendly X-Git-Tag: v0.7.8~84^2~2 X-Git-Url: http://nitlanguage.org jenkins: improve checksignedoffby to be more explicit and friendly Signed-off-by: Jean Privat --- diff --git a/misc/jenkins/checksignedoffby.sh b/misc/jenkins/checksignedoffby.sh index bebd200..9a5c27f 100755 --- a/misc/jenkins/checksignedoffby.sh +++ b/misc/jenkins/checksignedoffby.sh @@ -14,36 +14,47 @@ # limitations under the License. # Check missing signed-off-by in commits +# Usage: checksignedoffby from to -if test "$#" -lt 2; then - echo "Usage: checksignedoffby from to" - echo "" - exit -fi +set -e -from=$1 -to=$2 +from=${1:-origin/master} +to=${2:-HEAD} err=0 +cd `git rev-parse --show-toplevel` + +echo "checksignedoffby $from (`git rev-parse "$from"`) .. $to (`git rev-parse "$to"`)" for ref in `git rev-list --no-merges "$from".."$to"`; do # What is the expected? sig=`git --no-pager show -s --format='Signed-off-by: %an <%ae>' $ref` # Do we found some signed-off-by? git --no-pager show -s --format="%b" $ref | grep "^Signed-off-by:" > check_signedoff_list.out || { + echo "" + echo "Missing $sig for commit" git --no-pager show -s --oneline $ref - echo "Missing $sig" err=1 continue } # Do we found the expected thing? cat check_signedoff_list.out | grep -q "^$sig\$" && continue + echo "" + echo "Bad or missing Signed-off-by for commit" git --no-pager show -s --oneline $ref - echo "Bad or missing $sig; got:" + echo "Expected (from local git config):" + echo "$sig" + echo "Got:" cat check_signedoff_list.out err=1 done rm check_signedoff_list.out 2> /dev/null +if test "$err" = 1; then + echo "" + echo "Please check that each commit contains a \`Signed-off-by:\` statement that matches the author's name and email." + echo "Note that existing commits should be amended; pushing new commit is not sufficient." +fi + exit $err