Enable custom scripts to run on Git hooks

This commit is contained in:
YoshiRulz 2024-06-09 12:31:07 +10:00
parent 124a1ea509
commit 1d46919f6a
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ UpgradeLog.htm
*.opendb
/Dist/*.zip
/Dist/git_hooks/*.local.ps1
# mupen64plus-win32-deps is a submodule, so ignores should be in that repo
/libmupen64plus/mupen64plus-win32-deps/SDL-1.2.14/docs

View File

@ -1,3 +1,5 @@
#!/bin/sh
set -e
dotnet pwsh "./Dist/git_hooks/$(basename "$0").ps1" "$@"
kind="$(basename "$0")"
dotnet pwsh "./Dist/git_hooks/$kind.ps1" "$@"
if [ -e "./Dist/git_hooks/$kind.local.ps1" ]; then dotnet pwsh "./Dist/git_hooks/$kind.local.ps1" "$@"; fi

View File

@ -10,7 +10,6 @@ if (Test-Path $targetDir -PathType Container) { # is Git repo
} elseif ($(Get-FileHash $target).Hash -ne $(Get-FileHash $f.FullName).Hash) { # files differ
$head = Get-Content $target -TotalCount 3
echo "[$PSCommandFilename] found existing Git hook $($f.Name), please resolve conflict manually"
#TODO should REALLY make the scripts extensible then...
exit 1
}
# else no-op