Skip to content

fix(git-hooks): prefer core.hooksPath and avoid symlink on Windows#5438

Open
Shiven0504 wants to merge 3 commits into
clockworklabs:masterfrom
Shiven0504:fix/git-hooks-installer
Open

fix(git-hooks): prefer core.hooksPath and avoid symlink on Windows#5438
Shiven0504 wants to merge 3 commits into
clockworklabs:masterfrom
Shiven0504:fix/git-hooks-installer

Conversation

@Shiven0504

@Shiven0504 Shiven0504 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

git-hooks/install-hooks.sh unconditionally removes ../.git/hooks and attempts to create a symlink to ../git-hooks/hooks. On Windows (and some restricted environments) creating symlinks requires elevated privileges or is unsupported, and the script can unintentionally remove existing hooks. This causes the installer to fail or damage developer setups.

Steps to reproduce

  1. On a Windows machine without symlink privileges, run from repo root:
bash git-hooks/install-hooks.sh
  1. Observe that ln -s fails (or that .git/hooks was removed), and that hooks are not installed.

Expected behavior

  • Installer should set up hooks in a cross-platform way without requiring symlink privileges and without deleting existing hooks unless explicitly requested.

My Proposed fix

  • Use git config core.hooksPath git-hooks/hooks by default (works cross-platform and avoids symlinks).
  • Only attempt a symlink as a fallback when git is not available, and show a clear warning.
  • Only run rustup component add rustfmt if rustup is installed.

Patch / PR

I have a proposed patch that updates git-hooks/install-hooks.sh to prefer git config core.hooksPath and to guard rustup usage. The patch is ready in a branch fix/git-hooks-installer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant