Repository navigation
fix(hooks): idempotent portable git-hook installer + pre-commit branch-guard (#11598) - #11914
Merged
Merged
Conversation
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
This was referenced Jul 23, 2026
enforce-precommit SPDX header check is not a required status check — drift can merge silently
#12174
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
Issue #11598: git-hook enforcement silently dead —
core.hooksPathpinned to an absolute path,pre-pusha dangling symlink into a deleted worktree, nopre-commitat all. Documented protected-branch/worktree-only enforcement inactive.What Changed
scripts/install-git-hooks.sh: idempotent, machine-portable (derives paths fromgit rev-parse --show-toplevel/--git-common-dir), installs REAL hook files (not worktree symlinks), normalizes a badcore.hooksPathback to default, detects+replaces dangling symlinks, backs up unmanaged hooks.tools/git-hooks/pre-committemplate (main/master branch-guard, reuses canonical block logic from framework hook, inlined to be standalone).tools/git-hooks/install_hooks.sh(the symlink footgun) now a thin shim that execs the new installer — no code deleted.CLAUDE_GIT.md.Verification
Recreated the exact #11598 bug in a throwaway repo (absolute core.hooksPath + dangling pre-push symlink), ran the installer, attempted
git commitonmain→ hook printed "COMMIT BLOCKED" and commit returned exit 1 (no commit created);masteralso blocked;Dev_new_gui/issue-*allowed (exit 0). Second installer run = no-op (idempotent). Main tree's live hooks and global git config untouched.Model Used
Opus 4.8
Closes #11598