From ea431e71eafcde4bc922feb801d4cc4b746902ac Mon Sep 17 00:00:00 2001 From: NotAProfDev <84450364+NotAProfDev@users.noreply.github.com> Date: Sat, 23 May 2026 17:53:51 +0000 Subject: [PATCH] chore: Prevent direct commits to main branch; enforce PR workflow --- .githooks/pre-commit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 98f6420..9880cef 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -9,6 +9,13 @@ # the full suite (--all-targets, --all-features, tests, doc, cargo-deny). set -e +# Reject direct commits to main — all changes must go through a PR. +branch=$(git symbolic-ref HEAD 2>/dev/null) +if [ "$branch" = "refs/heads/main" ]; then + echo "error: direct commits to main are not allowed; create a feature branch first" + exit 1 +fi + # Reject if any file diverges from the canonical rustfmt style. # Fix with: cargo fmt --all cargo fmt --all -- --check