2 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Check missing signed-off-by in commits
17 # Usage: checksignedoffby from to
21 from
=${1:-origin/master}
26 cd `git rev-parse --show-toplevel`
28 echo "checksignedoffby $from (`git rev-parse "$from"`) .. $to (`git rev-parse "$to"`)"
29 for ref
in `git rev-list --no-merges "$from".."$to"`; do
30 # What is the expected?
31 sig
=`git --no-pager show -s --format='Signed-off-by: %an <%ae>' $ref`
32 # Do we found some signed-off-by?
33 git
--no
-pager show
-s
--format
="%b" $ref |
grep "^Signed-off-by:" > check_signedoff_list.out ||
{
35 echo "Missing $sig for commit"
36 git
--no
-pager show
-s
--oneline
$ref
40 # Do we found the expected thing?
41 cat check_signedoff_list.out |
grep -q
"^$sig\$" && continue
43 echo "Bad or missing Signed-off-by for commit"
44 git
--no
-pager show
-s
--oneline
$ref
45 echo "Expected (from local git config):"
48 cat check_signedoff_list.out
52 rm check_signedoff_list.out
2> /dev
/null
54 if test "$err" = 1; then
56 echo "Please check that each commit contains a \`Signed-off-by:\` statement that matches the author's name and email."
57 echo "Note that existing commits should be amended; pushing new commit is not sufficient."