]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - tools/add-git-hook.sh
meson: install the git hook (#6425)
[thirdparty/systemd.git] / tools / add-git-hook.sh
diff --git a/tools/add-git-hook.sh b/tools/add-git-hook.sh
new file mode 100755 (executable)
index 0000000..4ee919f
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh -eu
+
+cd "$MESON_SOURCE_ROOT"
+
+if [ ! -f .git/hooks/pre-commit.sample -o -f .git/hooks/pre-commit ]; then
+        exit 2 # not needed
+fi
+
+cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit
+chmod +x .git/hooks/pre-commit
+echo 'Activated pre-commit hook'