Repository navigation
Prevent automatic hook maintenance from modifying working-tree hooks - #1178
Merged
Merged
Conversation
roborev: Combined Review (
|
wesm
added a commit
that referenced
this pull request
Sep 19, 2026
Automatic hook maintenance now leaves tracked files behind hook symlinks unchanged. Previously, `.git/hooks/pre-push` could point to a tracked `.githooks/pre-push`; the directory check passed and automatic maintenance rewrote the target. The shared guard skips automatic maintenance for the repository when a hook points outside Git metadata or its symlink target cannot be resolved, including dangling links. Hooks that resolve within Git metadata remain eligible. Explicit install and repair retain their existing behavior. Follow-up to #1178. Co-authored-by: Wes McKinney <[email protected]>
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.
In a repository already using roborev hooks, when
core.hooksPathpoints to atracked
.githooksdirectory, a non-quiet review can upgrade existing hooks orinject missing companion hooks into the working tree. From a linked worktree,
relative hook paths resolve to the main checkout, so that checkout can become
dirty even though the review was started elsewhere. The CLI auto-installer lacked the Git-directory check already used
by daemon startup repair.
Apply the existing
HooksDirInsideGitDirpolicy to automatic CLI installationand post-update repair. The updater passes an internal
--git-dir-onlyoptionto the new binary's repair command, preserving the distinction between
automatic maintenance and an explicit repair request. Normal
.git/hooksandlinked worktrees' shared Git hooks continue to receive automatic maintenance.
Hooks in working trees or external shared directories now require an explicit
roborev init,roborev install-hook, orroborev install-hook repairto beinstalled or updated. Those explicit operations retain their existing behavior,
including editing tracked hook files when requested.
Related to #1165. This addresses
the reproduced automatic writes. The separately reported repeated injection and
shell syntax corruption have not been reproduced with the available hook
fixtures, so this change does not alter the snippet parser or claim to resolve
that symptom.