install-hooks.sh 466 B

12345678910111213141516171819
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # Self-installing git hooks for qmd
  4. # Called from package.json "prepare" script after bun install
  5. REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
  6. HOOKS_DIR="$REPO_ROOT/.git/hooks"
  7. if [[ ! -d "$HOOKS_DIR" ]]; then
  8. echo "Not a git repository, skipping hook install"
  9. exit 0
  10. fi
  11. # Install pre-push hook
  12. cp "$REPO_ROOT/scripts/pre-push" "$HOOKS_DIR/pre-push"
  13. chmod +x "$HOOKS_DIR/pre-push"
  14. echo "Installed git hooks: pre-push"