Add a commit-msg hook for this project's attribution form

card-games is published, so its commit messages are permanent public
record.  The new hook refuses a session-link trailer and a
Co-Authored-By trailer naming Claude or anthropic.com, and checks that
any Assisted-by trailer reads NAME (for PERSON; MODEL).  A message with
no Assisted-by line passes: attribution stays the author's call.

* hooks/commit-msg: New hook.
* hooks/applypatch-msg: New hook; runs commit-msg for git am.
* test/commit-msg-tests.el: New ERT tests that drive the sh hook.
* Makefile (GITHOOKS): New variable.
(hooks): Install all three hooks.
(test-hooks): New target.
(check): Run it.

Assisted-by: Mentat (for Corwin; claude-opus-5-5)
This commit is contained in:
Corwin Brust 2026-10-05 19:45:42 -05:00
parent 74af63a089
commit ee02437e3d
4 changed files with 161 additions and 7 deletions

11
hooks/applypatch-msg Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
# hooks/applypatch-msg -- give patches applied with `git am' the same
# trailer check as an ordinary commit, by running hooks/commit-msg.
#
# Install: make hooks
hook=$(git rev-parse --git-path hooks/commit-msg)
if [ -x "$hook" ]; then
exec "$hook" "$@"
fi
exit 0