From 65219d03e6e8c524cbdf0fae9ca0b6dbc836cbd2 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 9 Jun 2024 22:16:46 +1000 Subject: [PATCH] Fix Git hook installation flagging matching script as mismatch fixes 124a1ea50 --- Dist/install_git_hooks.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dist/install_git_hooks.ps1 b/Dist/install_git_hooks.ps1 index bfa257397a..51022a0532 100755 --- a/Dist/install_git_hooks.ps1 +++ b/Dist/install_git_hooks.ps1 @@ -2,13 +2,14 @@ $targetDir = "$PSScriptRoot/../.git/hooks" 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) if (!(Test-Path $target -PathType Leaf)) { # target file doesn't exist echo "[$PSCommandFilename] creating Git hook $($f.Name)" 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 + } 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" exit 1