You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(hooks): pre-commit fails in any worktree without a Makefile, so a non-code worktree cannot commit #678
Area: infra / hooks · bug · found by the pm-triage daily routine, which it blocks outright
Expected:.githooks/pre-commit gates commits that contain code. A worktree that holds no code has nothing to verify and should commit.
Actual:core.hooksPath is set in .git/config to an absolute path (<checkout>/.githooks), so the hook runs in every linked worktree, including ones that do not contain the repo's tree. The hook does cd "$(git rev-parse --show-toplevel)", which in a linked worktree is that worktree's own root, and then:
scripts/ci-marker.sh has-verify-marker is not found there, and its error is swallowed by 2>/dev/null, so the marker shortcut cannot be taken;
make verify finds no Makefile and fails with make: *** No rule to make target 'verify'. Stop. (GNU make's wording when a target is named and no makefile exists);
the hook prints 🛑 pre-commit: 'make verify' failed. and exits 1.
Reproduced at 4ff50745 by running the hook's own body from the pm-triage-state worktree.
Impact: no commit can be made in such a worktree, and --no-verify is not available to an agent session. The pm-triage routine keeps its state on the orphan branch pm-triage-state (three text files, no code, never pushed) and calls state.sh commit at the end of every run; that call now fails, so the routine loses its versioned audit trail. It still functions — state.sh read reads the file, not git — but each run's record goes uncommitted. Any future non-code worktree hits the same wall.
Scope: the hook has no business running where there is no tree to verify — an early [ -f Makefile ] || exit 0 is the whole fix. Leaving scripts/ci-marker.sh's failure silent under 2>/dev/null is what turned a missing file into a confusing make error; a missing-script case worth distinguishing from a missing marker.
Related: #170 (which added the tree-keyed marker), #454, #565
From the pm-triage daily routine (2026-09-28), which this blocked; reproduced against 4ff50745.
Correction to the premise (measured 2026-10-09):core.hooksPath is not necessarily absolute. make tools sets it to the relative .githooks (and new worktrees run make tools), and git resolves a relative core.hooksPath per worktree: each worktree runs its own branch's .githooks/, so a worktree whose branch has no .githooks/ (like an orphan state branch) runs no hooks and commits fine. The failure described here reproduces when core.hooksPath is an absolute path to one checkout's .githooks/, which is how this clone was set when the issue was filed.
The fix being prepared makes .githooks/pre-commit and .githooks/pre-push behave correctly under either setting: no Makefile in the worktree (pre-commit) or in the pushed commit (pre-push) means nothing to verify, and a missing or broken scripts/ci-marker.sh is reported instead of swallowed. The default stays relative.
Activity
EricAndrechek commentedon Oct 9, 2026
Correction to the premise (measured 2026-10-09):
core.hooksPathis not necessarily absolute.make toolssets it to the relative.githooks(and new worktrees runmake tools), and git resolves a relativecore.hooksPathper worktree: each worktree runs its own branch's.githooks/, so a worktree whose branch has no.githooks/(like an orphan state branch) runs no hooks and commits fine. The failure described here reproduces whencore.hooksPathis an absolute path to one checkout's.githooks/, which is how this clone was set when the issue was filed.The fix being prepared makes
.githooks/pre-commitand.githooks/pre-pushbehave correctly under either setting: no Makefile in the worktree (pre-commit) or in the pushed commit (pre-push) means nothing to verify, and a missing or brokenscripts/ci-marker.shis reported instead of swallowed. The default stays relative.— Posted by Claude Code on behalf of @EricAndrechek
ci: add make ci-remote and make the repo's hooks fail closed (#798)