blob: fc8963a45cf3a1e2f4b03cb5a6141a4497ecc6b2 [file] [log] [blame]
Sean Paul592c98a2018-09-04 15:30:29 -04001#! /usr/bin/env bash
2
Sean Paul68a78ef2018-09-04 15:32:26 -04003echoerr() {
4 printf "ERROR: %s\n" "$*" >&2
5}
6
Sean Paul592c98a2018-09-04 15:30:29 -04007git fetch https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer.git
8
Sean Paul68a78ef2018-09-04 15:32:26 -04009git log --pretty='%h' FETCH_HEAD..HEAD | while read h; do
10 subject=$(git show -s --pretty='%s' "$h")
11 if [[ $subject != drm_hwcomposer:* ]]; then
12 echoerr "Invalid subject prefix: $subject"
13 exit 1
14 fi
15
16 commit_body=$(git show -s --pretty=%b "$h")
17
18 author=$(git show -s --format='%an <%ae>')
19 sob=$(echo "$commit_body" | grep "Signed-off-by: $author")
20 if [ -z "$sob" ] ; then
21 echoerr "Author SoB tag is missing from commit $h"
22 exit 1
23 fi
24
25 committer=$(git show -s --format='%cn <%ce>')
26 sob=$(echo "$commit_body" | grep "Signed-off-by: $committer")
27 if [ -z "$sob" ] ; then
28 echoerr "Committer SoB tag is missing from commit $h"
29 exit 1
30 fi
31
32 git show "$h" -- | clang-format-diff-5.0 -p 1 -style=file > format-fixup.patch
33 if [ -s format-fixup.patch ]; then
34 cat format-fixup.patch >&2
35 exit 1
36 fi
37done