Summary
When core.hooksPath points to a global/shared directory, mix compile (auto-install) or mix git_hooks.install writes hooks into that directory and overwrites existing hooks with project-specific scripts.
Repro
git config --global core.hooksPath ~/.config/git/hooks (or any shared path)
- In a repo with
git_hooks auto-install enabled, run mix compile (or mix git_hooks.install)
- Observe hooks written into
~/.config/git/hooks with the repo project_path hardcoded
Expected
If the resolved hooks path is outside the repo, refuse install by default (warn) unless explicitly opted in.
Actual
Hooks are installed into the external hooks directory and clobber existing global hooks.
Proposed fix
Before installing, check whether git rev-parse --git-path hooks resolves inside the repo root. If not, skip with a warning unless allow_external_hooks_path: true or GIT_HOOKS_ALLOW_EXTERNAL=1 is set.
Summary
When
core.hooksPathpoints to a global/shared directory,mix compile(auto-install) ormix git_hooks.installwrites hooks into that directory and overwrites existing hooks with project-specific scripts.Repro
git config --global core.hooksPath ~/.config/git/hooks(or any shared path)git_hooksauto-install enabled, runmix compile(ormix git_hooks.install)~/.config/git/hookswith the repoproject_pathhardcodedExpected
If the resolved hooks path is outside the repo, refuse install by default (warn) unless explicitly opted in.
Actual
Hooks are installed into the external hooks directory and clobber existing global hooks.
Proposed fix
Before installing, check whether
git rev-parse --git-path hooksresolves inside the repo root. If not, skip with a warning unlessallow_external_hooks_path: trueorGIT_HOOKS_ALLOW_EXTERNAL=1is set.