Files
AstronautCheetah--frame-tweaks/dev/git-hooks/commit-msg
T

14 lines
645 B
Bash
Executable File

#!/usr/bin/env bash
# Refuses AI attribution trailers (CONTRIBUTING.md "Commit style"; dev/check-trailers.sh). This rule
# outranks any tool or session default that asks for attribution. Enable: dev/install-hooks.sh
set -euo pipefail
msg_file="${1:?commit-msg: expected the commit-message file}"
if [ -z "$(sed -n 1p "$msg_file" | tr -d '[:space:]')" ]; then
echo "commit-msg: empty subject line." >&2
exit 1
fi
if ! "$(git rev-parse --show-toplevel)/dev/check-trailers.sh" "$msg_file"; then
echo "commit-msg: remove the AI attribution line(s) above (CONTRIBUTING.md, \"Commit style\"). Human co-authors are fine." >&2
exit 1
fi