From d82a359e40459c189c7058e2bb178c7220ab5066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-R=C3=A9my=20Buchs?= Date: Wed, 25 Oct 2017 22:23:52 +0200 Subject: [PATCH] Add script to install pre-commit hook --- install-commit-hook | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 install-commit-hook diff --git a/install-commit-hook b/install-commit-hook new file mode 100755 index 000000000..be6525396 --- /dev/null +++ b/install-commit-hook @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ $# -eq 0 ] + then + echo "Usage: $0 YOUR-MNT" + exit +fi + +BASE="$(realpath "$0")" +BASE="$(dirname "$BASE")" +cd "$BASE" || exit 1 + +cat >> .git/hooks/pre-commit </dev/null | grep -v PASS 1>/dev/null 2>&1 && { echo "Schema validation failed, please check above!" 1>&2; exit 1; } +EOF +chmod +x .git/hooks/pre-commit +