Commit 68a78ef6 authored by Sean Paul's avatar Sean Paul 💬

drm_hwcomposer: Add commit message validation to CI

Check the subject prefix starts with "drm_hwcomposer: " and we have
Signed-off-by tags for both author and committer.

Change-Id: Ib26b8e5cbeae2156014f2bbfb8703545bdc1decb
Signed-off-by: Sean Paul's avatarSean Paul <seanpaul@chromium.org>
parent 592c98a0
Pipeline #4101 passed with stage
in 33 seconds
#! /usr/bin/env bash #! /usr/bin/env bash
echoerr() {
printf "ERROR: %s\n" "$*" >&2
}
git fetch https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer.git git fetch https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer.git
git diff -U0 --no-color FETCH_HEAD...HEAD -- | clang-format-diff-5.0 -p 1 -style=file > format-fixup.patch git log --pretty='%h' FETCH_HEAD..HEAD | while read h; do
if [ -s format-fixup.patch ]; then subject=$(git show -s --pretty='%s' "$h")
cat format-fixup.patch if [[ $subject != drm_hwcomposer:* ]]; then
exit 1 echoerr "Invalid subject prefix: $subject"
fi exit 1
fi
commit_body=$(git show -s --pretty=%b "$h")
author=$(git show -s --format='%an <%ae>')
sob=$(echo "$commit_body" | grep "Signed-off-by: $author")
if [ -z "$sob" ] ; then
echoerr "Author SoB tag is missing from commit $h"
exit 1
fi
committer=$(git show -s --format='%cn <%ce>')
sob=$(echo "$commit_body" | grep "Signed-off-by: $committer")
if [ -z "$sob" ] ; then
echoerr "Committer SoB tag is missing from commit $h"
exit 1
fi
git show "$h" -- | clang-format-diff-5.0 -p 1 -style=file > format-fixup.patch
if [ -s format-fixup.patch ]; then
cat format-fixup.patch >&2
exit 1
fi
done
...@@ -12,5 +12,4 @@ checkstyle: ...@@ -12,5 +12,4 @@ checkstyle:
script: "./.gitlab-ci-checkcommit.sh" script: "./.gitlab-ci-checkcommit.sh"
artifacts: artifacts:
when: on_failure when: on_failure
paths: untracked: true
- format-fixup.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment