Improve output of CI checks
[TortoiseGit.git] / .gitlab-ci / check-commits.sh
blobbefbb8bd32f783731e8a12cc6c056d8d338a5921
1 #!/bin/bash
2 set -eu -o pipefail
4 founderror=false
5 function error() {
6 echo -en "\e[1;31m";
7 echo "$*"
8 echo -en "\e[0m";
9 founderror=true
12 git fetch $CI_REPOSITORY_URL --shallow-exclude=refs/heads/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME refs/pipelines/$CI_PIPELINE_ID
13 git fetch $CI_REPOSITORY_URL --depth=1 $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
15 git rev-list --reverse FETCH_HEAD..$CI_COMMIT_SHA | ( while read commit_hash
17 echo "Checking commit $(git show --no-patch --pretty='%h ("%s")' $commit_hash)"
18 git show --no-patch --format=%B $commit_hash | grep -q "Signed-off-by:" || error "Commit $commit_hash does not contain a Signed-off-by line! Please see <https://gitlab.com/tortoisegit/tortoisegit/blob/master/CONTRIBUTING.md>"
19 done
20 if [[ $founderror != false ]]; then
21 exit 1;
23 ) || founderror=true
25 set +u
27 if [[ $founderror != false ]]; then
28 exit 1;