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