Skip to content

fix: use absolute path in git hooks for GUI app compatibility#664

Open
mvanhorn wants to merge 1 commit intoentireio:mainfrom
mvanhorn:osc/489-fix-hooks-absolute-path
Open

fix: use absolute path in git hooks for GUI app compatibility#664
mvanhorn wants to merge 1 commit intoentireio:mainfrom
mvanhorn:osc/489-fix-hooks-absolute-path

Conversation

@mvanhorn
Copy link
Contributor

@mvanhorn mvanhorn commented Mar 9, 2026

Summary

Fixes #489

The --absolute-git-hook-path flag (shipped in v0.4.9) solved this for users who knew about it, but the default behavior still uses bare entire which breaks in GUI git clients. This PR makes absolute path resolution the default, so hooks work out of the box in Xcode, Tower, and other GUI git clients that don't source shell profiles.

Changes

  • Modified hookCmdPrefix() to always resolve the absolute binary path via os.Executable() when not in localDev mode
  • Falls back gracefully to bare entire if path resolution fails (e.g., in test environments)
  • The absolutePath parameter is now ignored (kept for API compatibility) since absolute paths are always used
  • Updated tests to reflect the new default behavior

Testing

  • Run entire enable and verify generated hooks in .git/hooks/ contain absolute paths
  • Commit from Xcode or another GUI git client to verify hooks execute successfully
  • Run mise run test to verify updated unit tests pass

This contribution was developed with AI assistance (Claude Code).

Always resolve the absolute binary path via os.Executable() when
generating git hook scripts, instead of using bare "entire". GUI git
clients (Xcode, Tower, etc.) don't source shell profiles, so
~/.local/bin is not on PATH and hooks fail with "entire: command not
found". Falls back gracefully to bare "entire" if path resolution
fails.

Fixes entireio#489

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Git hooks fail with entire: command not found when committing from Xcode

1 participant