blob: 7366b2f1a1be709a92c9479a9e9163e6b4819514 [file] [log] [blame]
Fabio Utzig5b989102017-09-04 16:27:51 -03001#!/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
15MAIN_BRANCH=master
16
17# ignores last commit because travis/gh creates a merge commit
18commits=$(git log --format=%h ${MAIN_BRANCH}..HEAD | tail -n +2)
19
20for 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
28done