Update install-prereceive-hook.sh

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Mick Grove 2025-07-23 20:47:16 -07:00 committed by GitHub
commit 8328c88a44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,8 +20,13 @@ if ! command -v kingfisher >/dev/null 2>&1; then
fi
while read -r oldrev newrev refname; do
git diff-tree --no-commit-id --name-only -r "$oldrev" "$newrev" -z |
xargs -0 --no-run-if-empty kingfisher scan --no-update-check
if [ "$oldrev" = "0000000000000000000000000000000000000000" ]; then
git diff-tree --name-only -r "$newrev" -z |
xargs -0 --no-run-if-empty kingfisher scan --no-update-check
else
git diff-tree --no-commit-id --name-only -r "$oldrev" "$newrev" -z |
xargs -0 --no-run-if-empty kingfisher scan --no-update-check
fi
status=$?
if [ "$status" -ne 0 ]; then
echo "Kingfisher detected secrets in push. Push rejected." >&2