From d2903db557e86498e02480957de03cdbf093e1e5 Mon Sep 17 00:00:00 2001 From: peppa-bot Date: Mon, 16 Nov 2026 22:56:32 +0500 Subject: [PATCH] =?UTF-8?q?PEP-181:=20the=20live-copy=20pre-commit=20hook?= =?UTF-8?q?=20blocks=20only=20the=20live=20copy=20itself=20=E2=80=94=20wor?= =?UTF-8?q?ktrees=20share=20the=20hooks=20directory=20and=20kept=20failing?= =?UTF-8?q?=20to=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- scripts/live-deploy.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/live-deploy.sh b/scripts/live-deploy.sh index 266bae4e..51e3ad31 100755 --- a/scripts/live-deploy.sh +++ b/scripts/live-deploy.sh @@ -46,13 +46,16 @@ REPO="${GITEA_PLATFORM_REPO:-peppa/peppa}" # The live copy refuses commits from now on (agents must work in worktrees). HOOK="$(git rev-parse --git-path hooks)/pre-commit" -if ! grep -q "PEP-172" "$HOOK" 2>/dev/null; then +if ! grep -q "PEP-172/182" "$HOOK" 2>/dev/null; then mkdir -p "$(dirname "$HOOK")" cat >"$HOOK" <<'H' #!/bin/sh -# PEP-172: this is the copy the live site runs from — no commits here. Work in a worktree: -# git worktree add ~/.peppa/worktrees/peppa/ -b task/ origin/main +# PEP-172/182: this repository's own working copy is the one the live site runs from — no commits +# there. Worktrees (agents, coordinator) share this hooks directory and must keep committing. [ -n "$PEPPA_LIVE_COMMIT_OK" ] && exit 0 +top=$(git rev-parse --show-toplevel 2>/dev/null) +live=$(cd "$(git rev-parse --git-common-dir)/.." && pwd -P) +[ "$(cd "$top" && pwd -P)" = "$live" ] || exit 0 echo "Peppa FACTORY: в этой копии работает живой сайт — коммиты здесь запрещены. Работайте в git worktree." >&2 exit 1 H