Files
soulseek-rs-modded/.githooks/commit-msg
T
Michel de Graaf 9a8f616f9b chore: keep tool attribution out of the history
An assistant is tooling, like an editor or a formatter, and tooling does
not sign the work — a co-author trailer or a stray commit identity puts
one on the repository's GitHub contributor list.

Both guards are git's own, so they need no editor-specific directory in
the tree. .mailmap folds a tool identity into the author who owns the
work, which git honours in log and shortlog and GitHub honours when it
builds the contributor list. The commit-msg hook strips the trailers if
one is written anyway; CLAUDE.md says so in words and names the one-time
config that turns the hook on.
2026-09-09 20:10:07 +00:00

21 lines
850 B
Bash
Executable File

#!/bin/sh
# Commits carry the author's attribution and nothing else. Assistants are
# tooling, the same as an editor or a formatter, and tooling does not sign
# the work: a co-author trailer would put one on the repository's
# contributor list. The setting and CLAUDE.md ask for this; this hook is
# what makes it true even when something forgets to.
#
# Enable it once per clone: git config core.hooksPath .githooks
msg="$1"
tmp="$msg.attribution"
grep -v -i -E \
'^(Co-Authored-By:.*(claude|anthropic|copilot|cursor|codex)|Claude-Session:|Generated with .*Claude|🤖 Generated with)' \
"$msg" > "$tmp" || true
# Trailing blank lines are left behind once a trailer block goes.
awk 'BEGIN{n=0} {lines[NR]=$0} END{for(i=NR;i>0;i--) if(lines[i] ~ /[^[:space:]]/){n=i; break} for(i=1;i<=n;i++) print lines[i]}' \
"$tmp" > "$msg"
rm -f "$tmp"