The commit-msg hook was counting the end-of-line characters in the 50-
and 72-character limit, so commit messages had to be wrapped slightly
shorter in order to avoid the hook complaint. Strip the EOL characters
during the check instead.
Since we use universal newline handling during the file read, stripping
LF ('\n') should be enough to handle both Windows and Unix development
environments.
This git hook is copied automatically during CMake, and breaks commits
immediately afterwards if Python 2 isn't installed. Since Python 2 has
been end-of-life for a while now, take this chance to upgrade.
The commit message template may include the actual diff to be
committed separated with a special scissors line. This patch adds
support for the scissors line to the commit hook otherwise
the diff content may trigger any of the rules.
Our coding guidelines recommend following "The seven rules of a great
Git commit message" by Chris Beams:
https://chris.beams.io/posts/git-commit/
This change adds a Git commit hook that validates all Git commit
messages according to these rules (at least to the extent possible).
Currently, the hook simply prints a warning and a list of violations
in case of a non-conforming Git commit message. The commit is
otherwise accepted. This could be changed to entirely fail the commit,
or, via another hook, fail to push any code that is non-conformant.
The hook will be installed on a CMake run or when the hook source
changes.