From 4e659d810b0d0729d25a10851a12a460cf4f2945 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 9 Jun 2024 22:18:03 +1000 Subject: [PATCH] Use Git hook name without file extension for messages --- Dist/install_git_hooks.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dist/install_git_hooks.ps1 b/Dist/install_git_hooks.ps1 index 51022a0532..82ebc335b9 100755 --- a/Dist/install_git_hooks.ps1 +++ b/Dist/install_git_hooks.ps1 @@ -4,14 +4,15 @@ if (Test-Path $targetDir -PathType Container) { # is Git repo $PSCommandFilename = Split-Path $PSCommandPath -Leaf $shimChecksum = (Get-FileHash "$PSScriptRoot/git_hook_shim.sh").Hash foreach ($f in Get-ChildItem "$PSScriptRoot/git_hooks") { - $target = Join-Path $targetDir (Split-Path $f -LeafBase) + $hook = Split-Path $f -LeafBase + $target = Join-Path $targetDir $hook if (!(Test-Path $target -PathType Leaf)) { # target file doesn't exist - echo "[$PSCommandFilename] creating Git hook $($f.Name)" + echo "[$PSCommandFilename] creating Git hook $hook" Copy-Item "$PSScriptRoot/git_hook_shim.sh" $target #TODO use symlinks on Linux } elseif ((Get-FileHash $target).Hash -ne $shimChecksum) { # files differ $head = Get-Content $target -TotalCount 3 - echo "[$PSCommandFilename] found existing Git hook $($f.Name), please resolve conflict manually" + echo "[$PSCommandFilename] found existing Git hook $hook, please resolve conflict manually" exit 1 } # else no-op