fix: remove self-recursive husky hook stubs - #68
Merged
vishu-bh merged 1 commit intoAug 21, 2026
Conversation
.husky/post-checkout, post-commit and post-merge (added in aac9753) each contain only the path to their own shim. The shim runs the user hook with `sh -e`, so that line re-invokes the shim and every checkout, commit or merge recurses until killed. The stubs carry no commands, and husky's shims exit cleanly when a user hook file is absent, so delete them. Signed-off-by: Ahmad Al Tamimi <altamimi.dev@gmail.com>
gcgoncalves
approved these changes
Aug 21, 2026
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.
#49 added
.husky/post-checkout,.husky/post-commitand.husky/post-merge, each containing just the path to its own shim (e.g..husky/_/post-checkout). Husky's shim runs the user hook withsh -e, so that line calls the shim again, which runs the hook again, and so on. Once hooks are installed, everygit checkout, commit or merge loops until you kill it. I first hit it when a rebase hung on post-checkout (mentioned in #16 (comment)).The stubs don't run any commands, and the shims exit cleanly when a user hook file doesn't exist, so deleting them is the whole fix. The real hooks (
pre-commit,pre-push) are untouched. If post-checkout/commit/merge automation was intended in #49, real commands can be added back in those files later.Verified by toggling branches with hooks installed: checkout now completes instantly instead of recursing.