From f664669439c0f005e3579d1c67b4ebd9fa24de36 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 9 Feb 2022 18:13:40 -0500 Subject: Move git hooks to own folder Instead of symlinking, just set the local git config. --- Biz/Ide/hooks/post-checkout | 14 ++++++++++++++ Biz/Ide/hooks/post-merge | 2 ++ Biz/Ide/hooks/pre-commit | 19 +++++++++++++++++++ Biz/Ide/hooks/pre-push | 2 ++ Biz/Ide/post-checkout | 14 -------------- Biz/Ide/post-merge | 2 -- Biz/Ide/pre-commit | 19 ------------------- Biz/Ide/pre-push | 2 -- 8 files changed, 37 insertions(+), 37 deletions(-) create mode 100755 Biz/Ide/hooks/post-checkout create mode 100755 Biz/Ide/hooks/post-merge create mode 100755 Biz/Ide/hooks/pre-commit create mode 100755 Biz/Ide/hooks/pre-push delete mode 100755 Biz/Ide/post-checkout delete mode 100755 Biz/Ide/post-merge delete mode 100755 Biz/Ide/pre-commit delete mode 100755 Biz/Ide/pre-push (limited to 'Biz/Ide') diff --git a/Biz/Ide/hooks/post-checkout b/Biz/Ide/hooks/post-checkout new file mode 100755 index 0000000..95b35cd --- /dev/null +++ b/Biz/Ide/hooks/post-checkout @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e +init_tags=$BIZ_ROOT/Biz/Ide/init_tags.sh +old=$1 +new=$2 +# filter out only the changed haskell files +changed=($(git diff --diff-filter=d --name-only $old $new -- '*.hs')) +if [[ ! -r tags ]] +then + $init_tags +elif [[ ${#changed[@]} -gt 0 ]] +then + $init_tags $changed +fi diff --git a/Biz/Ide/hooks/post-merge b/Biz/Ide/hooks/post-merge new file mode 100755 index 0000000..624e797 --- /dev/null +++ b/Biz/Ide/hooks/post-merge @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec $BIZ_ROOT/Biz/Ide/post-checkout 'HEAD@{1}' HEAD diff --git a/Biz/Ide/hooks/pre-commit b/Biz/Ide/hooks/pre-commit new file mode 100755 index 0000000..507d7e6 --- /dev/null +++ b/Biz/Ide/hooks/pre-commit @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# - prevent frozen code from being checked in +# - guard against lint errors +## + set -e + changed=($(git diff-index --cached --name-only HEAD)) + for ns in ${changed[@]} + do + version=$($BIZ_ROOT/Biz/Ide/version $ns) + if (( $version < 1 )); then + echo "fail: version: $ns: $version" + exit 1 + else + echo "info: version: $ns: $version" + fi + done + $BIZ_ROOT/Biz/Ide/lint **/* +## diff --git a/Biz/Ide/hooks/pre-push b/Biz/Ide/hooks/pre-push new file mode 100755 index 0000000..3d00aea --- /dev/null +++ b/Biz/Ide/hooks/pre-push @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +lint **/* && bild --test **/* diff --git a/Biz/Ide/post-checkout b/Biz/Ide/post-checkout deleted file mode 100755 index 95b35cd..0000000 --- a/Biz/Ide/post-checkout +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -set -e -init_tags=$BIZ_ROOT/Biz/Ide/init_tags.sh -old=$1 -new=$2 -# filter out only the changed haskell files -changed=($(git diff --diff-filter=d --name-only $old $new -- '*.hs')) -if [[ ! -r tags ]] -then - $init_tags -elif [[ ${#changed[@]} -gt 0 ]] -then - $init_tags $changed -fi diff --git a/Biz/Ide/post-merge b/Biz/Ide/post-merge deleted file mode 100755 index 624e797..0000000 --- a/Biz/Ide/post-merge +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -exec $BIZ_ROOT/Biz/Ide/post-checkout 'HEAD@{1}' HEAD diff --git a/Biz/Ide/pre-commit b/Biz/Ide/pre-commit deleted file mode 100755 index 507d7e6..0000000 --- a/Biz/Ide/pre-commit +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# -# - prevent frozen code from being checked in -# - guard against lint errors -## - set -e - changed=($(git diff-index --cached --name-only HEAD)) - for ns in ${changed[@]} - do - version=$($BIZ_ROOT/Biz/Ide/version $ns) - if (( $version < 1 )); then - echo "fail: version: $ns: $version" - exit 1 - else - echo "info: version: $ns: $version" - fi - done - $BIZ_ROOT/Biz/Ide/lint **/* -## diff --git a/Biz/Ide/pre-push b/Biz/Ide/pre-push deleted file mode 100755 index 3d00aea..0000000 --- a/Biz/Ide/pre-push +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -lint **/* && bild --test **/* -- cgit v1.2.3