update pre-commit and pre-push to make things faster

This commit is contained in:
2023-05-28 13:37:15 -07:00
parent b4a73f8340
commit 69562da8f8
2 changed files with 8 additions and 4 deletions

View File

@@ -3,8 +3,11 @@ 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 || \
gitleaks protect --verbose --redact --staged && exit 0
if [ "$(git rev-list --count HEAD 2>/dev/null)" -lt 2 2> /dev/null > /dev/null ]; then
gitleaks protect --staged --verbose --no-banner --no-color
exit 0
fi
repo_root=$(git rev-parse --show-toplevel)
pushd $repo_root 2>/dev/null > /dev/null
@@ -32,4 +35,5 @@ if $hasLargeFile; then
exit 1
fi
popd $repo_root 2>/dev/null > /dev/null || true
gitleaks protect --verbose --redact --staged
gitleaks protect --staged --verbose --no-banner --no-color 2>/dev/null