From 7753212d964ded8daa9d63f14c61c2da3f62b209 Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Sun, 28 May 2023 13:15:47 -0700 Subject: [PATCH] update precommit hook to run gitleaks regardless of commit numbers --- pre-commit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pre-commit b/pre-commit index fc7b9f3..e84341d 100755 --- a/pre-commit +++ b/pre-commit @@ -3,7 +3,8 @@ set +eou pipefail size_limit=$((5 * 2**20)) # make sure we have at least 1 commit in the repo # so we don't fail on the first commit -test "$(git rev-list --count HEAD 2>/dev/null)" -gt 1 2> /dev/null > /dev/null || exit 0 +test "$(git rev-list --count HEAD 2>/dev/null)" -gt 1 2> /dev/null > /dev/null || \ + gitleaks protect --verbose --redact --staged && exit 0 repo_root=$(git rev-parse --show-toplevel) pushd $repo_root 2>/dev/null > /dev/null