Fabio Utzig | 5b98910 | 2017-09-04 16:27:51 -0300 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | MAIN_BRANCH=master |
| 16 | |
| 17 | # ignores last commit because travis/gh creates a merge commit |
| 18 | commits=$(git log --format=%h ${MAIN_BRANCH}..HEAD | tail -n +2) |
| 19 | |
| 20 | for sha in $commits; do |
| 21 | actual=$(git show -s --format=%B ${sha} | sed '/^$/d' | tail -n 1) |
| 22 | expected="Signed-off-by: $(git show -s --format="%an <%ae>" ${sha})" |
| 23 | |
| 24 | if [ "${actual}" != "${expected}" ]; then |
| 25 | echo -e "${sha} is missing or using an invalid \"Signed-off-by:\" line" |
| 26 | exit 1 |
| 27 | fi |
| 28 | done |