From 52c582a3ac7871bd0856b1a9af5eb7f2b109b2ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:30:46 +0000 Subject: [PATCH 1/2] Initial plan From f221d8d0431680429c6497acdbdb8fd77dd87f77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:34:54 +0000 Subject: [PATCH 2/2] fix: convert Windows-style path to POSIX notation for core.hooksPath Git for Windows bash requires POSIX drive notation (e.g. /c/Users/...) rather than Windows-style paths (C:\Users\...) for core.hooksPath. - install.ps1: detect Windows drive-letter paths and rewrite them to POSIX notation before calling `git config --global core.hooksPath` - install.Tests.ps1: add test verifying POSIX path is set on Windows Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- git-hooks/install.ps1 | 12 ++++++++++-- git-hooks/tests/install.Tests.ps1 | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/git-hooks/install.ps1 b/git-hooks/install.ps1 index 61071fa..6e6ecb6 100644 --- a/git-hooks/install.ps1 +++ b/git-hooks/install.ps1 @@ -37,5 +37,13 @@ pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass \ Write-Host "Installed bash commit-msg hook → $HooksDir" } -git config --global core.hooksPath $HooksDir -Write-Host "Global git hooks path set to: $HooksDir" +# Git for Windows bash requires POSIX drive notation (e.g. /c/Users/..., not C:\Users\...) +if ($HooksDir -match '^([A-Za-z]):[/\\](.*)$') { + $drive = $Matches[1].ToLower() + $rest = $Matches[2] -replace '\\', '/' + $posixHooksDir = "/$drive/$rest" +} else { + $posixHooksDir = $HooksDir -replace '\\', '/' +} +git config --global core.hooksPath $posixHooksDir +Write-Host "Global git hooks path set to: $posixHooksDir" diff --git a/git-hooks/tests/install.Tests.ps1 b/git-hooks/tests/install.Tests.ps1 index 1fbe42b..d10a29d 100644 --- a/git-hooks/tests/install.Tests.ps1 +++ b/git-hooks/tests/install.Tests.ps1 @@ -29,6 +29,14 @@ Describe 'install.ps1 -UsePowerShell shim' { } } + It 'should convert Windows path to POSIX drive notation when setting core.hooksPath' { + if ($IsWindows) { + $configuredPath = git config --global core.hooksPath + $configuredPath | Should -Match '^/[a-z]/' + $configuredPath | Should -Not -Match '^[A-Za-z]:' + } + } + It 'should write the commit-msg shim without a UTF-8 BOM' { $shimPath = Join-Path $tempDir 'commit-msg' $shimPath | Should -Exist