#!/usr/bin/env bash
# Git pre-commit hook: blocks a commit if its staged changes contain a secret.
#
# Activate once per clone: git config core.hooksPath .githooks
# Skip in an emergency: git commit --no-verify
if ! command -v betterleaks >/dev/null 2>&1; then
  echo "pre-commit: betterleaks is not installed, so staged changes can't be scanned" >&2
  exit 1
fi

exec betterleaks git --pre-commit --staged --redact --no-banner --no-color .
