From f9d7a587a23a964be76883f1bd6ef2eee08e756c Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 26 Apr 2020 21:50:04 +0200 Subject: Add pre-commit hooks to check for syntax errors and coding style Just run the git-hooks/install.sh script to install the pre-commit hook --- git-hooks/install.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 git-hooks/install.sh (limited to 'git-hooks/install.sh') diff --git a/git-hooks/install.sh b/git-hooks/install.sh new file mode 100755 index 0000000..17d59bc --- /dev/null +++ b/git-hooks/install.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +githooks_dir="$(git rev-parse --git-dir)" +for hook in hooks/*; do + hook="${hook#hooks/}" + if [ -f "$githooks_dir/hooks/$hook" ]; then + mv "$githooks_dir/hooks/$hook" "$githooks_dir/hooks/own_$hook" + fi + + echo '#!/bin/sh + exec "$(git rev-parse --git-dir)/../git-hooks/loader.sh" '"$hook"' "$@" + ' > "$githooks_dir/hooks/$hook" + chmod +x "$githooks_dir/hooks/$hook" +done -- cgit v1.2.3-54-g00ecf