From ca145aa8ab357bbc4db61f064d76bdc02f3f7f45 Mon Sep 17 00:00:00 2001 From: Rahul Gupta Date: Wed, 26 Jul 2017 15:22:37 +0530 Subject: [PATCH] adds pre-commit hook support --- git-hooks.sh | 26 ++++++++++++++++++++++++++ hooks/check_ast.py | 1 + hooks/check_flake8.py | 1 - hooks/check_merge_conflict.py | 2 ++ hooks/pre-commit.py | 33 +++++++++++++++++++++++++++++++++ hooks/util.py | 26 ++++++++++++++++++++------ 6 files changed, 82 insertions(+), 7 deletions(-) create mode 100755 git-hooks.sh create mode 100755 hooks/pre-commit.py diff --git a/git-hooks.sh b/git-hooks.sh new file mode 100755 index 0000000..a59902d --- /dev/null +++ b/git-hooks.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +echo "Configuring pre-commit hook..." + +# make a symbolic link with the pre-commit hook +if [ ! -f ./git/hooks/check_flake8.py ]; then + ln hooks/check_flake8.py .git/hooks/check_flake8.py +fi +if [ ! -f ./git/hooks/check_ast.py ]; then + ln hooks/check_ast.py .git/hooks/check_ast.py +fi +if [ ! -f ./git/hooks/check_merge_conflict.py ]; then + ln hooks/check_merge_conflict.py .git/hooks/check_merge_conflict.py +fi +if [ ! -f ./git/hooks/util.py ]; then + ln hooks/util.py .git/hooks/util.py +fi + +if [ ! -f ./git/hooks/pre-commit ]; then + ln hooks/pre-commit.py .git/hooks/pre-commit + echo "Done" +else + cat <