nexus/scripts/nexus-commit-msg-hook.sh
Mikkel Georgsen bc9fd5d81b [nexus] chore(01-02): install commit-msg hook and enable git rerere
- Add scripts/nexus-commit-msg-hook.sh (tracked source for hook)
- Install hook at .git/hooks/commit-msg (executable)
- Enable git rerere with autoupdate for automated conflict re-resolution
2026-04-01 07:43:45 +02:00

23 lines
722 B
Bash
Executable file

#!/bin/sh
# Nexus fork: enforce [nexus] prefix on all fork commits
# Allows upstream merge commits and rebase-generated commits through
MSG_FILE="$1"
FIRST_LINE=$(head -1 "$MSG_FILE")
# Skip merge commits (git generates these automatically during rebase/merge)
if echo "$FIRST_LINE" | grep -qE "^Merge (branch|pull request|remote-tracking)"; then
exit 0
fi
# Skip fixup/squash commits (used during interactive rebase)
if echo "$FIRST_LINE" | grep -qE "^(fixup|squash)!"; then
exit 0
fi
# Enforce [nexus] prefix
if ! echo "$FIRST_LINE" | grep -qE "^\[nexus\]"; then
echo "ERROR: Commit message must start with [nexus]"
echo " Got: $FIRST_LINE"
echo " Example: [nexus] feat: add branding package"
exit 1
fi