From 6899e0ae1e821e0a6d7270dfbb02b29fbfb463f9 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Tue, 11 Aug 2026 22:46:32 -0400 Subject: [PATCH] fix(docs): make the signoff hook identity-aware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_01HDdo1rNRVQnVRRdsqSrvG3 Signed-off-by: cliffhall --- AGENTS.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index afbb05c4..ae7cb54d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 ```