mirror of
https://github.com/coder/coder.git
synced 2026-06-04 13:38:21 +00:00
dd34e3d3c2
Agents hit short shell timeouts on `git commit` (~13s) before `make pre-commit` finishes (~20s warm), then disable hooks via `git config core.hooksPath /dev/null`. This bypasses all local checks and, because it writes to shared `.git/config`, silently disables hooks for every other worktree too. Add explicit timing guidance to AGENTS.md, and write worktree-scoped `core.hooksPath` in post-checkout, pre-commit, and pre-push hooks to make the bypass ineffective.
24 lines
712 B
Bash
Executable File
24 lines
712 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Pre-commit hook that runs CI-equivalent checks locally.
|
|
# Runs `make pre-commit` (gen, fmt, lint, typos, build) which
|
|
# catches most CI failures without needing Docker or Playwright.
|
|
# The full CI suite (including tests) runs via the pre-push hook.
|
|
#
|
|
# Installation (worktree-compatible):
|
|
#
|
|
# git config core.hooksPath scripts/githooks
|
|
#
|
|
# Bypass: git commit --no-verify
|
|
|
|
set -euo pipefail
|
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
unset GIT_DIR
|
|
|
|
# In linked worktrees, set worktree-scoped hooksPath to override shared config.
|
|
if [[ "$(git rev-parse --git-dir)" != "$(git rev-parse --git-common-dir)" ]]; then
|
|
git config --worktree core.hooksPath scripts/githooks
|
|
fi
|
|
exec make pre-commit
|