summaryrefslogtreecommitdiff
path: root/data/install-git-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'data/install-git-hook.sh')
-rw-r--r--data/install-git-hook.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/data/install-git-hook.sh b/data/install-git-hook.sh
new file mode 100644
index 0000000..355867b
--- /dev/null
+++ b/data/install-git-hook.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+cd "$MESON_SOURCE_ROOT"
+
+[ -d .git ] || exit 2 # not a git repo
+[ ! -f .git/hooks/pre-commit ] || exit 2 # already installed
+
+cp data/pre-commit-hook .git/hooks/pre-commit
+cp data/canonicalize_filename.sh .git/hooks/canonicalize_filename.sh
+chmod +x .git/hooks/pre-commit
+echo "Activated pre-commit hook" \ No newline at end of file