1
0
Fork 0
android_external_drm_hwcomp.../.ci/.gitlab-ci-checkcommit.sh
Drew Davenport 151c10dc9a CI: Remove drm_hwcomposer: prefix requirement
The prefix doesn't provide a lot of value, and unnecessarily lengthens
the commit message subject lines.

Change-Id: I5e234510b2ad9822e95135e56a8a19b4b9329357
2025-09-29 09:26:01 -06:00

57 lines
1.3 KiB
Bash
Executable file

#! /usr/bin/env bash
check_tool_installed() {
if ! command -v $1 &> /dev/null
then
echo "Please install '$1' tool"
exit 1
fi
}
echoerr() {
printf "ERROR: %s\n" "$*" >&2
}
findtag() {
local commit_body tag person
commit_body=$1
tag=$2
person=$3
# trim duplicate spaces from commit body and person
match="$tag: $(echo $person | tr -s ' ')"
if [ -z "$(echo "$commit_body" | tr -s ' ' | grep -i "$match")" ]; then
echoerr "Tag is missing from commit body"
echoerr ""
echoerr "Looking for '"$match"' in: "
echoerr "-----------------------------------------------------"
echoerr "$commit_body"
echoerr "-----------------------------------------------------"
echoerr ""
return 0
fi
return 1
}
check_tool_installed bpfmt
check_tool_installed clang-format-diff-19
git fetch https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer.git
git log --pretty='%h' FETCH_HEAD..HEAD | while read h; do
commit_body=$(git show -s --pretty=%b "$h")
git diff -U0 "$h" -- | clang-format-diff-19 -p 1 -style=file > /tmp/format-fixup.patch
if [ -s /tmp/format-fixup.patch ]; then
cat /tmp/format-fixup.patch >&2
exit 1
fi
find -name "*.bp" -exec bpfmt -d -s {} \; > /tmp/bpfmt.patch
if [ -s /tmp/bpfmt.patch ]; then
cat /tmp/bpfmt.patch >&2
exit 1
fi
done