Sean Paul | 592c98a | 2018-09-04 15:30:29 -0400 | [diff] [blame] | 1 | #! /usr/bin/env bash |
| 2 | |
Sean Paul | 68a78ef | 2018-09-04 15:32:26 -0400 | [diff] [blame^] | 3 | echoerr() { |
| 4 | printf "ERROR: %s\n" "$*" >&2 |
| 5 | } |
| 6 | |
Sean Paul | 592c98a | 2018-09-04 15:30:29 -0400 | [diff] [blame] | 7 | git fetch https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer.git |
| 8 | |
Sean Paul | 68a78ef | 2018-09-04 15:32:26 -0400 | [diff] [blame^] | 9 | git 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 |
| 37 | done |