Meta: Revise lint-commit.sh regex for the title

This mainly changes two aspects:
- The category can now be a single letter, such as 'w' to indicate the
  file Utilities/w.cpp
- Spaces in the category (or list) are no longer allowed. This follows
  the lived practice of writing category lists as "Foo+Bar: Quux"

Closes #15243.
This commit is contained in:
Ben Wiederhake 2022-09-14 22:48:54 +02:00 committed by Sam Atkins
parent a60c5166c6
commit 42db468ef5
Notes: sideshowbarker 2024-07-17 07:09:27 +09:00

View File

@ -34,7 +34,7 @@ while read -r line; do
error "Empty line between commit title and body is missing"
fi
category_pattern="^\S.*?\S: .+"
category_pattern='^(Revert "|\S+: )'
if [[ $line_number -eq 1 ]] && (echo "$line" | grep -E -v -q "$category_pattern"); then
error "Missing category in commit title (if this is a fix up of a previous commit, it should be squashed)"
fi