Repository navigation
fix(hooks): turn off core.fsmonitor on the format adapters' and reap helper's git calls - #17260
Conversation
…helper's git calls The format hooks source their plugin's git-hook adapters, whose config and install lookups ran plain `git ls-files` in the edited file's repository, and worktree-remove-gate runs reap-project-plugin-records.sh, whose settings-state check ran plain `git ls-files` and `git diff`. Each read the index and so started the command that repository's `core.fsmonitor` names. The shared resolve-tool.sh adds `rt_git`: `hook::git_untrusted` when a hook loaded hook-utils.sh first, plain git in a git hook. The bash, JavaScript, Markdown and Python adapters and markdown-gates.sh call it. The reap helper sources hook-utils.sh and calls `hook::git_untrusted`. The override list stays in one definition. Refs: #16959 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reap now sends its git calls through hook::git_untrusted, so the logging git shim records the overrides ahead of the subcommand. Refs: #16959 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Owner of this pull request: the control-hub session for plugin profiles (melodic-software/control-hub#11). It waits on CI Status and the review lanes; the hub reads the reviews and merges. Other sessions: do not push, resolve threads or queue it. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: no security issues foundThis PR hardens git calls; it does not loosen anything. It adds What I checked:
The diff changes no trust controls, plugin manifests, workflows or standing instructions. The PR description lists remaining gaps ( critical-findings: 0 |
|
claude-review reviewed Code review: PR #17260, no findingsI read every hunk of the full diff. That covers the 17 files in the read scope; the copies listed in What changed
What I checked (by reading code; I ran nothing)
Closing issue: none. The PR says Path-scoped rules: no Loosened-check verdict: fail (default; no
Security-scoped observations are left to the separate security-review lane. Verifier dropped 0 of 0 candidates. |
Refs: #16959
Summary
#17104 and #17082 routed the hooks' own git calls through
hook::git_untrusted(lib/hook-utils.sh), which passes the overrides PR #16954 uses (--no-pager -c core.fsmonitor=false -c core.hooksPath=/dev/null). Two files hooks run from outsidehooks/still ran plain git in a repository the hook did not create, and each read the index, which starts the command that repository'score.fsmonitornames:git-hooks/adapters.sh(and markdown-format'smarkdown-gates.sh). On every edit, the adapter's config and install lookups rangit -C <repo> ls-filesin the edited file's repository.worktree-remove-gate.shrunsscripts/reap-project-plugin-records.sh, whose settings-state check rangit ls-filesandgit diffin the worktree once a plugin install record names it.Fix
lib/git-hooks/resolve-tool.shaddsrt_git:hook::git_untrustedwhen a Claude Code hook loadedhook-utils.shfirst, plaingitotherwise (a git hook, which runs inside git's own command, or a git-hook entry run on its own). The override list stays in one definition,hook::git_untrusted. The selector followsworktree_root_gitinscripts/worktree-root-resolve.sh.adapters.shand inmarkdown-gates.shcallsrt_git.reap-project-plugin-records.shsources its plugin'shooks/hook-utils.shand callshook::git_untrusted.scripts/sync-shared-copies.shregenerated the eightresolve-tool.shcopies. Onepatchfragment per touched plugin (nine).Verification
lib/hook-git.test.shgains nine planted-fsmonitor cases: each format adapter's config lookup, bash-format's.shellcheckrclookup, the committed-node_modulesand committed-.venvchecks, and the reap helper's settings state (with a stubclaudethat reports an install record for the worktree, and an assertion that the reap reaches its survivor check). Before the fix: 6 passed, 9 failed, each with "ran the repository's core.fsmonitor". After: 15 passed, 0 failed.scripts/affected-tests.sh --runover this diff: every selected suite passes after one test edit.reap-project-plugin-records.test.shcase 66 records git's argv through a shim and expected a barerev-parse --is-inside-work-tree; it now expects the overrides ahead of it (94/94). The format plugins'format,lint,end-of-turnandresolve-toolsuites all report 0 failed.lib/prerequisites.test.mjsis selected but not run by the shell runner.shellcheck -xclean on every changed shell file;check-changelog-fragments.sh --checkpasses; the pre-pushcheck-affectedpassed.Not delivered
The issue's first Done-when line ("every git call a hook makes against a repository it did not create") is still not met by these three PRs together:
worktree-create-gate.shrunsscripts/worktree-create.sh, whosegit worktree addruns the repository's post-checkout hook: passingcore.hooksPath=/dev/nullthere changes what it does. Owner decision, as fix(hooks): turn off core.fsmonitor and hooks on the remaining hook git calls #17082 recorded.git-hooks/lint.sh --worktreeorformat.sh --worktree) as a separate process in the session's project directory:actionlint-check.sh:13,bash-format.sh:27,go-format.sh:24,javascript-format.sh:16,markdown-format.sh:13,powershell-format.sh:19,python-format.sh:21,spelling.sh:33. That process has nohook-utils.sh, socheck-lib.shand the adapters run plain git. Covering it needs a design choice: the hook passes the overrides throughGIT_CONFIG_COUNT/GIT_CONFIG_KEY_nto the child, orcheck-lib.shgains a wrapper for its own git calls.filter.<driver>.clean;-ccannot switch off a driver whose name is unknown (fix(hooks): turn off core.fsmonitor and hooks on the remaining hook git calls #17082).Related
🤖 Generated with Claude Code