fix(install): resolve git hooks dir via git plumbing, drop stale manifest fields
scripts/install.sh hardcoded $REPO_ROOT/.git/hooks, which breaks under any git worktree checkout (.git is a file there, not a directory) — this is what blocks every worktree-based agent from pushing cleanly. Resolve the hooks directory via `git rev-parse --git-path hooks` instead, normalizing to an absolute path since git returns it relative to the queried repo root for plain checkouts but absolute for worktrees. Also drops `agents`/`skills` fields from plugins/bin, plugins/core, and plugins/gitea plugin.json where the referenced directories don't exist on main yet (bin never had an agents/ dir; core and gitea's real skill/agent content is still pending merge from an in-flight branch) — these were failing scripts/check-manifests.sh and blocking pushes for unrelated work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNJWdVvdgvZCHi1hZGqgVQ
This commit is contained in:
@@ -22,7 +22,7 @@ TEMP_HOME="$(mktemp -d)"
|
||||
trap 'rm -rf "$TEMP_REPO" "$TEMP_HOME"' EXIT
|
||||
|
||||
mkdir -p "$TEMP_REPO/scripts"
|
||||
mkdir -p "$TEMP_REPO/.git/hooks"
|
||||
git -C "$TEMP_REPO" init -q
|
||||
|
||||
# Minimal deploy-manifest.sh — empty deploy lists so install.sh reaches the
|
||||
# hook-copy block without attempting to copy files that don't exist in the
|
||||
@@ -90,6 +90,28 @@ else
|
||||
fi
|
||||
rmdir "$HOOKS_SRC/not-a-hook"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- hook install: resolves correctly when GIT_DIR is inherited (hook context) ---"
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Git sets GIT_DIR/GIT_WORK_TREE for child processes when this script itself
|
||||
# runs as a hook (e.g. pre-push). Simulate that and confirm install.sh still
|
||||
# resolves hooks against $TEMP_REPO, not the inherited GIT_DIR.
|
||||
OTHER_REPO="$(mktemp -d)"
|
||||
git -C "$OTHER_REPO" init -q
|
||||
if HOME="$TEMP_HOME" GIT_DIR="$OTHER_REPO/.git" GIT_WORK_TREE="$OTHER_REPO" \
|
||||
bash "$TEMP_REPO/scripts/install.sh" > /dev/null 2>&1; then
|
||||
if [[ -f "$TEMP_REPO/.git/hooks/post-push" ]]; then
|
||||
pass "resolves \$TEMP_REPO/.git/hooks/ even with inherited GIT_DIR"
|
||||
else
|
||||
fail "installed into inherited GIT_DIR instead of \$TEMP_REPO"
|
||||
fi
|
||||
else
|
||||
fail "install.sh failed when GIT_DIR/GIT_WORK_TREE were inherited"
|
||||
fi
|
||||
rm -rf "$OTHER_REPO"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- hook install: idempotent ---"
|
||||
|
||||
Reference in New Issue
Block a user