0b89294af7
Two git hooks, tracked in .githooks and wired with core.hooksPath so a fresh clone gets them with one config line. pre-commit refuses master and refuses more than 300 changed lines in non-markdown files. Markdown is exempt because docs land as one batch. This is a commit-time guard, which diff-budget.sh is not: that hook blocks the agent's edits and says nothing when either of us commits. commit-msg requires (V-<id>), not (#<id>). Gitea autolinks # to its own issues, and Vikunja is the tracker. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
819 B
Bash
Executable File
31 lines
819 B
Bash
Executable File
#!/bin/sh
|
|
# Every commit names the Vikunja task it belongs to.
|
|
#
|
|
# router: narrow the single-token rule (V-359)
|
|
#
|
|
# V- and not #, because Gitea autolinks #359 to a Gitea issue, which is a
|
|
# different tracker and a wrong link.
|
|
#
|
|
# Exempt: merges, reverts, fixup/squash, and the initial commit.
|
|
|
|
msg_file=$1
|
|
subject=$(sed -n '1p' "$msg_file")
|
|
|
|
case "$subject" in
|
|
Merge\ *|Revert\ *|fixup!\ *|squash!\ *|amend!\ *) exit 0 ;;
|
|
esac
|
|
|
|
if [ -f "$(git rev-parse --git-dir)/MERGE_HEAD" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
if printf '%s' "$subject" | grep -qE '\(V-[0-9]+\)$'; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "commit-msg: subject must end with a Vikunja task ref." >&2
|
|
echo " got: $subject" >&2
|
|
echo " want: router: narrow the single-token rule (V-359)" >&2
|
|
echo " No task yet? Create one. Work without a task is work nobody can resume." >&2
|
|
exit 1
|