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(bin): run no repository hook when core.hooksPath is empty - #6216
In a worker launched by fm-spawn.sh, every commit in a repository whose own config sets core.hooksPath to the empty string is refused: the per-task AI-trailer wrapper resolves the repository's hooks with git rev-parse --path-format=absolute --git-path hooks, which fails on an empty core.hooksPath, and the wrapper refuses rather than chain.
Plain git treats that configuration as "no hooks"; the wrapper should do the same and run no repository hook, while every other lookup failure still refuses.
What Changed
bin/fm-git-strip-ai-trailers.sh: when the chained hook's git rev-parse --git-path hooks lookup fails, the wrapper now checks the repository's own core.hooksPath. If it is set to the empty string, the wrapper exits 0 and runs no repository hook, the same as plain git. For any other failure, including a valueless core.hooksPath key or a path that cannot be expanded, it reruns the lookup so git's error is shown, then refuses as before.
tests/fm-git-strip-ai-trailers.test.sh: adds three tests. With an empty core.hooksPath, a commit succeeds, runs no repository hook, and still has its AI trailer stripped. With an unresolvable ~user hooks path, the commit is refused and git's lookup error is shown. With a valueless core.hooksPath key, the commit is refused.
docs/configuration.md: the commit attribution section now says an empty core.hooksPath runs no project hook, and that any other hooks-directory resolution failure still fails the git operation.
✅ Low: The change is a narrow fallback that only runs when the hooks lookup fails. It exits 0 only when git config --get --type=path core.hooksPath succeeds with an empty value, which matches plain git's "no hooks" behavior (checked on git 2.53). A valueless key, an unresolvable ~user path and every other failure still refuse, and each of these cases has a regression test that fails without the fix.
Testing
I ran the real fm-spawn.sh (only the tmux pane was stubbed) against disposable lab homes and projects. The worker launch line it produced was then run in a real tmux pane on a private socket. At base, a commit in a project with core.hooksPath='' was refused, reproducing #6171. With the fix the commit lands, the AI trailer is stripped and no repository hook runs, matching plain git. An unresolvable path and a valueless key are still refused with HEAD unchanged, and a husky hooksPath still chains its hook. The targeted test file passes. The only issue is a cosmetic duplicate git error line on the refusal paths. All labs and base checkouts were removed afterwards.
Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario
Result
Live
Evidence
Worker spawned by fm-spawn.sh commits (with an AI Co-authored-by trailer) in a project whose config sets core.hooksPath='' - commit lands, trailer stripped, no repository hook runs
✅ pass
live
target-empty-hookspath.log: commit-exit=0, commit LANDED, message has no Cursor trailer, default .git/hooks/pre-commit did not run
Regression reproduction: same spawned-worker commit at base eb77f02 is refused
✅ pass
live
base-empty-hookspath.log: 'fatal: The empty string is not a valid path' + 'refusing to skip its pre-commit hook', commit-exit=1, HEAD unchanged
Adversarial: project core.hooksPath that cannot be resolved (~no-such-user) - spawned worker's commit is still refused with git's error shown
✅ pass
live
target-unresolvable-hookspath.log: 'failed to expand user dir'
Intent
Fixes #6171
In a worker launched by
fm-spawn.sh, every commit in a repository whose own config setscore.hooksPathto the empty string is refused: the per-task AI-trailer wrapper resolves the repository's hooks withgit rev-parse --path-format=absolute --git-path hooks, which fails on an emptycore.hooksPath, and the wrapper refuses rather than chain.Plain git treats that configuration as "no hooks"; the wrapper should do the same and run no repository hook, while every other lookup failure still refuses.
What Changed
bin/fm-git-strip-ai-trailers.sh: when the chained hook'sgit rev-parse --git-path hookslookup fails, the wrapper now checks the repository's owncore.hooksPath. If it is set to the empty string, the wrapper exits 0 and runs no repository hook, the same as plain git. For any other failure, including a valuelesscore.hooksPathkey or a path that cannot be expanded, it reruns the lookup so git's error is shown, then refuses as before.tests/fm-git-strip-ai-trailers.test.sh: adds three tests. With an emptycore.hooksPath, a commit succeeds, runs no repository hook, and still has its AI trailer stripped. With an unresolvable~userhooks path, the commit is refused and git's lookup error is shown. With a valuelesscore.hooksPathkey, the commit is refused.docs/configuration.md: the commit attribution section now says an emptycore.hooksPathruns no project hook, and that any other hooks-directory resolution failure still fails the git operation.Fixes #6171
Risk Assessment
✅ Low: The change is a narrow fallback that only runs when the hooks lookup fails. It exits 0 only when
git config --get --type=path core.hooksPathsucceeds with an empty value, which matches plain git's "no hooks" behavior (checked on git 2.53). A valueless key, an unresolvable~userpath and every other failure still refuse, and each of these cases has a regression test that fails without the fix.Testing
I ran the real fm-spawn.sh (only the tmux pane was stubbed) against disposable lab homes and projects. The worker launch line it produced was then run in a real tmux pane on a private socket. At base, a commit in a project with core.hooksPath='' was refused, reproducing #6171. With the fix the commit lands, the AI trailer is stripped and no repository hook runs, matching plain git. An unresolvable path and a valueless key are still refused with HEAD unchanged, and a husky hooksPath still chains its hook. The targeted test file passes. The only issue is a cosmetic duplicate git error line on the refusal paths. All labs and base checkouts were removed afterwards.