fix(docs): make the signoff hook identity-aware

The hook skipped insertion on any `Signed-off-by:` line, which is wrong for a
message reused from another commit — cherry-pick, `git commit -c` — since that
message already carries someone else's trailer. The DCO check requires one
matching the *author*, so the guard would be satisfied while the commit still
failed the gate: the exact silent-no-op failure mode this bullet warns about.

Match this identity's exact trailer instead. Verified: a plain commit signs
once; a message already carrying another author's signoff now gets the real
author's added alongside it; `git commit -s` is not double-signed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDdo1rNRVQnVRRdsqSrvG3
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-11 22:46:32 -04:00
commit 6899e0ae1e

View file

@ -213,8 +213,12 @@ All work should be driven by items on the project board.
```sh
cat > .git/hooks/prepare-commit-msg <<'HOOK'
#!/bin/sh
grep -q '^Signed-off-by:' "$1" || git interpret-trailers --in-place \
--trailer "Signed-off-by: $(git config user.name) <$(git config user.email)>" "$1"
# Match THIS identity's exact trailer, not any Signed-off-by: a message
# reused from another commit (cherry-pick, `git commit -c`) already carries
# someone else's, and the DCO check requires one matching the author — so a
# bare `grep '^Signed-off-by:'` would skip and leave the commit failing.
SOB="Signed-off-by: $(git config user.name) <$(git config user.email)>"
grep -qF "$SOB" "$1" || git interpret-trailers --in-place --trailer "$SOB" "$1"
HOOK
chmod +x .git/hooks/prepare-commit-msg
```