Merge: share/libgc: option to use a local version of the source pkgs
[nit.git] / misc / jenkins / checksignedoffby.sh
1 #!/bin/bash
2 # This file is part of NIT ( http://www.nitlanguage.org ).
3 #
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
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 # Check missing signed-off-by in commits
17
18 if test "$#" -lt 2; then
19 echo "Usage: checksignedoffby from to"
20 echo ""
21 exit
22 fi
23
24 from=$1
25 to=$2
26
27 err=0
28
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 || {
34 git --no-pager show -s --oneline $ref
35 echo "Missing $sig"
36 err=1
37 continue
38 }
39 # Do we found the expected thing?
40 cat check_signedoff_list.out | grep -q "^$sig\$" && continue
41 git --no-pager show -s --oneline $ref
42 echo "Bad or missing $sig; got:"
43 cat check_signedoff_list.out
44 err=1
45 done
46
47 rm check_signedoff_list.out 2> /dev/null
48
49 exit $err