diff --git a/Dist/git_hook_shims/commit-msg b/Dist/git_hook_shim.sh similarity index 100% rename from Dist/git_hook_shims/commit-msg rename to Dist/git_hook_shim.sh diff --git a/Dist/git_hooks/commit-msg.ps1 b/Dist/git_hooks/commit-msg.ps1 index 6e96f0fc1e..5324d4e38d 100755 --- a/Dist/git_hooks/commit-msg.ps1 +++ b/Dist/git_hooks/commit-msg.ps1 @@ -1,5 +1,4 @@ #!/usr/bin/env -S dotnet pwsh -# placed here by BizHawk build scripts and may be updated automatically $msg = Get-Content $args[0] -TotalCount 1 # this commit hook is always passed the commit message scratch file's path, so read the first line of that if ($msg -Match "^fix(?:ed|es)? #\d+$") { echo "An issue reference alone is not a suitable commit message. Vetoed." diff --git a/Dist/install_git_hooks.ps1 b/Dist/install_git_hooks.ps1 index 571e9b3aac..cdb2bc4cd5 100644 --- a/Dist/install_git_hooks.ps1 +++ b/Dist/install_git_hooks.ps1 @@ -1,12 +1,11 @@ $targetDir = "$PSScriptRoot/../.git/hooks" if (Test-Path $targetDir -PathType Container) { # is Git repo $PSCommandFilename = Split-Path $PSCommandPath -Leaf - foreach ($f in Get-ChildItem "$PSScriptRoot/git_hook_shims") { - $target = Join-Path $targetDir $f.Name + foreach ($f in Get-ChildItem "$PSScriptRoot/git_hooks") { + $target = Join-Path $targetDir (Split-Path $f -LeafBase) if (!(Test-Path $target -PathType Leaf)) { # target file doesn't exist echo "[$PSCommandFilename] creating Git hook $($f.Name)" - Copy-Item $f $target - #TODO generate shim? the only difference between different shims would be the filename in the Batch part (and if there was an equivalent to `basename $0` then that would be the same too + Copy-Item "$PSScriptRoot/git_hook_shim.sh" $target #TODO use symlinks on Linux } elseif ($(Get-FileHash $target).Hash -ne $(Get-FileHash $f.FullName).Hash) { # files differ $head = Get-Content $target -TotalCount 3