From 425dcbf0e9b58802de9b498d829191937a6a7aac Mon Sep 17 00:00:00 2001 From: Mick Grove Date: Wed, 23 Jul 2025 20:47:16 -0700 Subject: [PATCH] Update install-prereceive-hook.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- install-prereceive-hook.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/install-prereceive-hook.sh b/install-prereceive-hook.sh index 3ca4081..f7a4d5e 100644 --- a/install-prereceive-hook.sh +++ b/install-prereceive-hook.sh @@ -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