Skip to content

Add DCO sign-off hook#2

Merged
miharp merged 1 commit into
mainfrom
chore/dco-signoff-hook
Jul 23, 2026
Merged

Add DCO sign-off hook#2
miharp merged 1 commit into
mainfrom
chore/dco-signoff-hook

Conversation

@miharp

@miharp miharp commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Makes DCO sign-off automatic so it cannot be forgotten.

Finding: GPG signing was already working

I previously suggested neither signing nor sign-off was in place. That was half wrong — commit.gpgsign=true is set globally, so every commit in this repo has been GPG-signed all along, and GitHub reports verified=true, reason=valid for all of them including the squash merge. The key is already registered on the account.

The actual gap was only DCO sign-off.

The hook

.githooks/prepare-commit-msg appends a Signed-off-by trailer when one is not already present. Enabled with:

git config core.hooksPath .githooks

Relying on remembering -s means it gets forgotten exactly once, and fixing that afterwards means rewriting history. The hook removes the failure mode. It uses grep -F so an email or name containing regex metacharacters cannot cause a false match, and it no-ops when user.name/user.email are unset rather than writing a malformed trailer.

Also pins commit.gpgsign locally so the repo does not silently depend on global config being right.

Verification

This PR's own commit was produced with no -s flag and came out both signed and signed-off:

0b56741  sig=G  Add DCO sign-off hook
Signed-off-by: Michael Harp <mike@mikeharp.com>

🤖 Generated with Claude Code

OpenVox projects require DCO sign-off. Relying on remembering -s means it
gets forgotten exactly once, and fixing that afterwards means rewriting
history. A prepare-commit-msg hook makes it automatic for anyone who runs
'git config core.hooksPath .githooks'.

GPG signing was already active via global commit.gpgsign; this pins it
locally so the repo does not depend on global state.

Signed-off-by: Michael Harp <mike@mikeharp.com>
@miharp
miharp merged commit b6cb471 into main Jul 23, 2026
7 checks passed
@miharp
miharp deleted the chore/dco-signoff-hook branch July 23, 2026 16:10
miharp added a commit that referenced this pull request Jul 23, 2026
OpenVox projects require DCO sign-off. Relying on remembering -s means it
gets forgotten exactly once, and fixing that afterwards means rewriting
history. A prepare-commit-msg hook makes it automatic for anyone who runs
'git config core.hooksPath .githooks'.

GPG signing was already active via global commit.gpgsign; this pins it
locally so the repo does not depend on global state.

Signed-off-by: Michael Harp <mike@mikeharp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant