fix(git-hooks): prefer core.hooksPath and avoid symlink on Windows#5438
Open
Shiven0504 wants to merge 3 commits into
Open
fix(git-hooks): prefer core.hooksPath and avoid symlink on Windows#5438Shiven0504 wants to merge 3 commits into
Shiven0504 wants to merge 3 commits into
Conversation
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.
Summary
git-hooks/install-hooks.shunconditionally removes../.git/hooksand 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
ln -sfails (or that.git/hookswas removed), and that hooks are not installed.Expected behavior
My Proposed fix
git config core.hooksPath git-hooks/hooksby default (works cross-platform and avoids symlinks).gitis not available, and show a clear warning.rustup component add rustfmtifrustupis installed.Patch / PR
I have a proposed patch that updates
git-hooks/install-hooks.shto prefergit config core.hooksPathand to guardrustupusage. The patch is ready in a branchfix/git-hooks-installer.