hooks: take the hook path back after pre-commit install

Commit

peyton-altyesterday

pre-commit install moves Entire's hook to <hook>.legacy and leaves pre-commit to run it. That is unreliable: pre-commit gives .legacy no stdin except for pre-push (post-rewrite gets nothing), skips it without --hook-dir, and never reaches it when pre-commit is missing. Installed after Entire chained to an earlier pre-commit wrapper, every commit aborted on pre-commit's legacy loop guard.

When the hook path holds pre-commit's wrapper (header or script ID, hook-impl, this hook type and --hook-dir) and .legacy carries Entire's marker, install puts the user's own hook in .legacy (where pre-commit runs it), backs the wrapper up to .pre-entire and writes Entire's hook: Entire, then pre-commit, then the user's hook, each once. Entire keeps a copy of that user hook in <hook>.legacy.pre-entire, because the next pre-commit install moves a hook onto .legacy. Uninstall puts pre-commit's wrapper and the user's hook back.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Entire-Checkpoint: 01M476EXRRXXYBZAC5JQ9KN51E

Checkpoints

Triaging Git Hooks Tickets and Adversarial Review

Claude CodeOpus 5.5
View session
Checkpoint 1