mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
ci: Nag about invalid commit message subject prefixes
Prefixes use an abbreviated form of the module or section being changed. For example, changes to MetaBackend/meta-backend.c are prefixed with `backend:` and generic changes to src/x11/ are prefixed `x11:`. This extra nit picking check is meant to avoid using non-abbreviated prefixes, e.g. `MetaBackend:`, or `meta-backend:`, other prefixes are Currently consisting of only a "blacklist". https://gitlab.gnome.org/GNOME/mutter/merge_requests/519
This commit is contained in:
parent
5199c7834d
commit
7b3dee2d97
@ -23,9 +23,30 @@ function commit_message_has_url() {
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function commit_message_subject_is_compliant() {
|
||||||
|
commit=$1
|
||||||
|
commit_message_subject=$(git show -s --format='format:%s' $commit)
|
||||||
|
|
||||||
|
if echo "$commit_message_subject" | grep -qe "\(^meta-\|^Meta\)"; then
|
||||||
|
echo " - message subject should not be prefixed with 'meta-' or 'Meta'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
for commit in $commits; do
|
for commit in $commits; do
|
||||||
|
commit_short=$(echo $commit | cut -c -8)
|
||||||
|
|
||||||
if ! commit_message_has_url $commit; then
|
if ! commit_message_has_url $commit; then
|
||||||
echo "Missing merge request or issue URL on commit $(echo $commit | cut -c -8)"
|
echo "Missing merge request or issue URL on commit $commit_short"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
errors=$(commit_message_subject_is_compliant $commit)
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo "Commit message for $commit_short is not compliant:"
|
||||||
|
echo "$errors"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user