]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pmdk/utils/check-commits.sh
2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2016-2020, Intel Corporation
6 # Used to check whether all the commit messages in a pull request
7 # follow the GIT/PMDK guidelines.
9 # usage: ./check-commits.sh [range]
13 # on CI run this check only for pull requests
14 if [ -n "$CI_REPO_SLUG" ]; then
15 if [[ "$CI_REPO_SLUG" != "$GITHUB_REPO" \
16 ||
$CI_EVENT_TYPE != "pull_request" ]];
18 echo "SKIP: $0 can only be executed for pull requests to $GITHUB_REPO"
22 # CI_COMMIT_RANGE can be invalid for force pushes - use another
23 # method to determine the list of commits
24 if [[ $
(git rev-list
$CI_COMMIT_RANGE 2>/dev
/null
) ||
-n "$CI_COMMIT_RANGE" ]]; then
25 MERGE_BASE
=$
(echo $CI_COMMIT_RANGE | cut
-d.
-f1)
26 [ -z $MERGE_BASE ] && \
27 MERGE_BASE
=$
(git log
--pretty="%cN:%H" |
grep GitHub |
head -n1 | cut
-d: -f2)
28 RANGE
=$MERGE_BASE..
$CI_COMMIT
30 MERGE_BASE
=$
(git log
--pretty="%cN:%H" |
grep GitHub |
head -n1 | cut
-d: -f2)
31 RANGE
=$MERGE_BASE..HEAD
37 COMMITS
=$
(git log
--pretty=%H
$RANGE)
41 for commit
in $COMMITS; do
42 `dirname $0`/check-commit.sh
$commit