fix(enable): explain core.hooksPath when hooks dir is not a directory - #1851
Merged
Conversation
When core.hooksPath points at a non-directory (commonly /dev/null, the idiom for globally disabling git hooks), 'entire enable' failed with a raw 'mkdir /dev/null: not a directory' error that users read as a crash. Detect the case before MkdirAll and return guidance naming core.hooksPath, how to find where it is set, and how to unset or override it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the entire enable hook-install path by detecting when Git resolves the hooks directory to a non-directory (e.g. core.hooksPath=/dev/null) and returning a targeted, actionable error instead of a raw mkdir ... not a directory failure.
Changes:
- Add a pre-
MkdirAllos.Statguard inInstallGitHookto detect a non-directory hooks path and return guidance mentioningcore.hooksPath. - Add a new test covering the “hooks path is not a directory” scenario, including a Windows-specific setup path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/entire/cli/strategy/hooks.go | Adds a guard to produce a clearer error when the resolved hooks path exists but is not a directory. |
| cmd/entire/cli/strategy/hooks_test.go | Adds regression coverage for the non-directory hooks-path case (Unix /dev/null, Windows regular file). |
…oundary Review follow-ups: core.hooksPath pointing below a non-directory (/dev/null/hooks) stat-fails with ENOTDIR and skipped the guidance; extend the guard to cover it. Add a boundary test proving a configured-but-missing hooks path still gets created by MkdirAll. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…alue Copilot review follow-up: the error prints the path resolved via git rev-parse --git-path hooks, which may normalize separators on Windows; assert against GetHooksDir's result so the test matches what the error actually contains. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
gtrrz-victor
approved these changes
Jul 27, 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.
https://entire.io/gh/entireio/cli/trails/937
Problem
A user reported
entire enable"crashing" with:The cause is
core.hooksPath = /dev/nullin their git config — a common idiom for globally disabling git hooks (e.g. to neuter Husky).GetHooksDirresolves the hooks dir viagit rev-parse --git-path hooks, which faithfully returns/dev/null, andos.MkdirAllthen fails with a raw OS error. The message says what failed but never mentionscore.hooksPath, so users can't connect it to their own config and report it as a bug.Fix
Before
MkdirAll, stat the resolved hooks path; if it exists and is not a directory, fail with guidance:Testing
TestInstallGitHook_HooksPathNotADirectory(uses/dev/nullon Unix, a regular file on Windows); watched it fail on the old behavior firstmise run fmt,mise run lint,mise run test(8302 tests) all green🤖 Generated with Claude Code
Note
Low Risk
Small, pre-install validation and clearer errors only; no change to successful hook installation paths.
Overview
When
entire enableinstalls git hooks, it now detects a resolved hooks path that exists but is not a directory (e.g.core.hooksPath = /dev/null) beforeMkdirAll, instead of surfacing a genericmkdir … not a directoryerror.Users get an error that names
core.hooksPath, shows the resolved path, and suggestsgit config --show-origin --get-all core.hooksPathplus unset or repo-local override before re-runningentire enable.Coverage is added in
TestInstallGitHook_HooksPathNotADirectory(/dev/nullon Unix, a file path on Windows).Reviewed by Cursor Bugbot for commit 07ce70c. Configure here.