chore: adopt gitflow socle + pre-commit hook

This commit is contained in:
Bastien Chanot 2026-06-29 03:03:13 +02:00
parent 1254643d06
commit 620071b19c
2 changed files with 27 additions and 0 deletions

23
.githooks/pre-commit Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# gitflow pre-commit — generated by gitflow_init. Do not hand-edit.
# Mirrors gitflow_protected_base (lib/gitflow.sh). Drift caught by T10.
gd=$(git rev-parse --git-dir)
br=$(git symbolic-ref --short -q HEAD 2>/dev/null)
git rev-parse --verify -q HEAD >/dev/null 2>&1 || exit 0 # root commit — allow
[ -f "$gd/MERGE_HEAD" ] && exit 0 # merge in progress — allow
case "$br" in
main|develop) ;; # protected — keep checking
*) exit 0 ;; # working branch — allow
esac
# whitelist: all-staged-under-.claude/ (memory/doc/deploy helpers) — allow
if [ -z "$(git diff --cached --name-only | grep -v '^\.claude/' | head -1)" ]; then
exit 0
fi
echo "gitflow pre-commit: BLOCKED — direct commit on '$br'." >&2
echo " Branch from the right base (feature/bugfix->develop, hotfix->main), or merge." >&2
echo " (.claude/** memory commits are exempt; --no-verify bypasses locally.)" >&2
exit 1

4
.gitignore vendored
View File

@ -136,3 +136,7 @@ skills-external/frontend-design/
# deploy: transient per-deploy state (the runbook/ledger/oracle ARE committed)
.claude/deploy/NEXT.sh
.claude/deploy/PENDING.json
# ── gitflow standard socle (added by gitflow_init; additive, safe to edit) ──
*.log
!.claude/deploy/