From 88504c812183f192086dd8f31e14f2a74e56ed12 Mon Sep 17 00:00:00 2001 From: Melvin PETIT Date: Fri, 12 Jun 2026 11:11:06 +0200 Subject: [PATCH] chore(hooks): install hooks via explicit script, no silent skip --- .githooks/install.sh | 13 +++++++++++++ package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 .githooks/install.sh diff --git a/.githooks/install.sh b/.githooks/install.sh new file mode 100755 index 0000000..b6abd09 --- /dev/null +++ b/.githooks/install.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh +# Point git at the versioned hooks. Non-fatal outside a git work tree +# (tarball installs, CI cache restores) but loud about what it did, so a +# contributor never silently ends up with inactive hooks. +set -eu + +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "[hooks] skipped: not a git work tree" + exit 0 +fi + +git config core.hooksPath .githooks +echo "[hooks] core.hooksPath set to .githooks" diff --git a/package.json b/package.json index aa44a79..22e3e0b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint:fix": "eslint . --fix", "seed": "dotenv -e .env.local -- tsx prisma/seed.ts", "postinstall": "prisma generate", - "prepare": "git config core.hooksPath .githooks 2>/dev/null || true", + "prepare": "sh .githooks/install.sh", "seed:dev": "dotenv -e .env.local -- tsx prisma/seed.dev.ts" }, "dependencies": {