Commit 531f5dc
Resolve Windows hook Bash through PATH (#2198)
Extensionless commit hooks on Windows were launched through a bare bash.exe. Windows CreateProcess searches system directories before PATH for bare executable names, so the WSL launcher in System32 could preempt Git for Windows Bash and make every commit fail when no WSL distribution was installed.
A regression test mocks PATH resolution and demonstrates that the hook command previously remained bare instead of using the resolved executable. Resolve bash.exe with shutil.which before spawning, while retaining the bare-name fallback when PATH has no Bash so existing WSL-based behavior remains available.
This matches Git for Windows v2.55.0.windows.3, whose git var GIT_SHELL_PATH reports the absolute PATH-selected sh.exe. It also follows gix-command's principle of resolving a Git-associated Windows shell before falling back to a bare executable name.
Validated with the focused Windows hook regression, the commit-hook test group, Ruff lint and format checks, and git diff --check.1 parent 04960cf commit 531f5dc
2 files changed
Lines changed: 26 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| |||
112 | 127 | | |
113 | 128 | | |
114 | 129 | | |
115 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
116 | 135 | | |
117 | 136 | | |
118 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
| 1131 | + | |
1131 | 1132 | | |
1132 | 1133 | | |
1133 | 1134 | | |
1134 | | - | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
1135 | 1138 | | |
1136 | 1139 | | |
1137 | 1140 | | |
1138 | 1141 | | |
| 1142 | + | |
1139 | 1143 | | |
1140 | | - | |
| 1144 | + | |
1141 | 1145 | | |
1142 | 1146 | | |
1143 | 1147 | | |
| |||
0 commit comments