Hook dispatcher breaks on Git for Windows when core.hooksPath is an absolute path
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
調査の方向性
Start by reading the generated .vite-hooks/_/h script described in the issue, then locate the code that generates it and any related hook tests. Reproduce on Windows with Git for Windows using an absolute core.hooksPath. Done means the generated dispatcher handles that path correctly and git commit runs the repository's hook without the reported module error or silently falling back to a global vp.
索引モデルが issue の本文から書いたものです。
説明
Version: vite-plus 1.3.0 (global vp 1.2.0), Git for Windows 2.54.0, Node 22.23.1, Windows 11.
What happens
When core.hooksPath is an absolute Windows path such as C:\repo\.vite-hooks\_, every hook fails:
Error: Cannot find module 'C:\Program Files\Git\Users\me\repo\node_modules\vite-plus\bin\vp'
VITE+ - pre-commit script failed (code 1)
Some tools set an absolute path on purpose. For example, worktree managers point linked worktrees at the main checkout's dispatcher, because the generated .vite-hooks/_ is gitignored and missing in a new worktree.
Cause
The generated .vite-hooks/_/h derives the repo root from $0 and prepends it to PATH:
d="$(dirname "$(dirname "$(dirname "$0")")")"
export PATH="$d/node_modules/.bin:$PATH"
Git for Windows passes $0 as a drive-letter path, so d is C:\repo or C:/repo. sh splits the PATH entry at the drive colon into C and \repo\node_modules\.bin:
- With backslashes, sh finds the pnpm shim through the drive-relative path. The shim then passes
/repo/...to Node, which MSYS maps under the Git install root, giving the MODULE_NOT_FOUND above. - With forward slashes, the entry doesn't resolve, and
vpsilently falls back to whatever else is on PATH (here, the global~/.vite-plus/bin/vp).
Repro
- On Windows with Git for Windows, run
vp config --hooksin a repo whose pre-commit isvp staged. - Run
git config core.hooksPath "$(pwd -W)\.vite-hooks\_", or anyC:\...absolute value. - Run
git commit.
Suggested fix
Normalise d (or $0) to a POSIX path before building PATH, for example:
case "$d" in [A-Za-z]:*) command -v cygpath >/dev/null 2>&1 && d=$(cygpath -u "$d") ;; esac
Alternatively, avoid putting a path derived from $0 into PATH. Husky uses the cwd-relative node_modules/.bin.
Workaround we use (documented init script ~/.config/vite-plus/hooks-init.sh):
case "$0" in
[A-Za-z]:*)
if [ -z "${VP_HOOKS_POSIX_REEXEC-}" ] && command -v cygpath >/dev/null 2>&1; then
export VP_HOOKS_POSIX_REEXEC=1
exec sh "$(cygpath -u "$0")" "$@"
fi
;;
esac
- 主要言語
- Rust
- スター
- 6.3k
- フォーク
- 283
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 200
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/vite-plus のほかの issue
-
contribution welcome
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
voidzero-dev/vite-plus#3096 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
pending triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
voidzero-dev/vite-plus#2882 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
voidzero-dev/vite-plus#2097 · コメント 10 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
`vp run`: Terminal UI for parallel/persistent tasks with per-task log panes (like Turborepo's TUI)オープンpending triage
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
voidzero-dev/vite-plus#3098 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`vp env exec` / `vp node` ignore `nodeShimMode: system_first`, download a managed runtime (~192 MB) that `vp env clean` then refuses to remove対応中かも @liangmiQwQ が 1 日前に担当しました。 オープンpending triage
voidzero-dev/vite-plus#3093 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/vite-plus の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
521xueweihan/HelloGitHub#4023 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cloudflare/pingora#1055 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信