Update check-commit to enforce proper commit message summaries

This commit is contained in:
Dan Smith 2025-08-17 10:18:39 -07:00 committed by Dan Smith
parent 71d0ef9fcd
commit d90e2c6a5d
2 changed files with 15 additions and 1 deletions

View file

@ -6,7 +6,7 @@ The following must be true before PRs can be merged:
1. Commits should be rebased (or simply rebase-able in the web UI) on current master. Do not put merge commits in a PR.
1. Commits in a single PR should be related. Squash intermediate commits into logical units (i.e. "fix tests" commits need not survive on their own). Keep cleanup commits separate from functional changes.
1. Major new features or bug fixes should reference a [CHIRP issue](https://chirpmyradio.com/projects/chirp/issues) _in the commit message_. Do this with the pattern `Fixes #1234` or `Related to #1234` so that the ticket system links the commit to the issue.
1. Please write a reasonable commit message, especially if making some change that isn't totally obvious (such as adding a new model, adding a feature, etc). The first line of every commit is emailed to the users' list after each build. It should be short, but meaningful for regular users (examples: "thd74: Fixed tone decoding" or "uv5r: Added settings support").
1. Please write a reasonable commit message, especially if making some change that isn't totally obvious (such as adding a new model, adding a feature, etc). The first line of every commit is emailed to the users' list after each build. It should be short, but meaningful for regular users (examples: "thd74: Fixed tone decoding" or "uv5r: Added settings support"). There should be a blank line after the first, followed by additional text so that it gets formatted properly for the mailing list.
1. New drivers should be accompanied by a test image in `tests/images` (except for thin aliases where the driver is sufficiently tested already). All new drivers must use `MemoryMapBytes`.
1. All files must be GPLv3 licensed or contain no license verbiage. No additional restrictions can be placed on the usage (i.e. such as noncommercial).
1. Do not add new py2-compatibility code (No new uses of `six`, `future`, etc).

View file

@ -115,4 +115,18 @@ done
rm -f added_lines license_lines
commits=$(git log --pretty=format:%h ${BASE}..)
for commit in $commits; do
git log -n1 $commit --pretty=format:%B > commit_msg
if [[ `sed -n '1p' commit_msg | wc -c` > 99 ]]; then
fail "First line of commit message of $commit must be <99 chars"
fi
if [[ `wc -l < commit_msg` > 1 ]]; then
if ! sed -n '2p' commit_msg | grep '^$'; then
fail "Second line of commit message of $commit must be blank for proper formatting in the notification emails"
fi
fi
rm -f commit_msg
done
exit $RETCODE