This commit is contained in:
谢宇宁
2026-09-15 16:25:45 +07:00
parent da39ab9a2a
commit 2d63d37930
449 changed files with 25632 additions and 24085 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env sh
# 启用 .githooks/ 作为 hooksPath
# 设计:docs/superpowers/specs/2026-05-14-beidou-git-governance-design.md §4.4
# 注:已永久移除 pre-commit(原 pnpm lint-staged),仅保留 commit-msg 单 hook
set -eu
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "✗ 当前目录不是 Git 仓库" >&2
exit 1
fi
repo_root=$(git rev-parse --show-toplevel)
cd "$repo_root"
if [ ! -f .githooks/commit-msg ]; then
echo "✗ 缺少 .githooks/commit-msg,请确认治理物料已分发" >&2
exit 1
fi
git config core.hooksPath .githooks
chmod +x .githooks/commit-msg
# 历史遗留的 pre-commit 文件若仍存在,移除可执行位以防误触发
if [ -f .githooks/pre-commit ]; then
chmod -x .githooks/pre-commit 2>/dev/null || true
fi
echo "✓ commit-msg hook 已启用(.githooks/commit-msg)"
echo " 紧急绕过:git commit --no-verify"