IssueID #1104: separated git hook from command script (so it can be run independently)

This commit is contained in:
Cyprian Laskowski 2020-02-21 20:44:39 +01:00
parent 47802a3577
commit d9eab477fd
3 changed files with 24 additions and 18 deletions

View File

@ -2,5 +2,5 @@
top_dir=`git rev-parse --show-toplevel`
cd $top_dir/.git/hooks
ln -s ../../scripts/validate_examples pre-commit
ln -s ../../scripts/validate_examples_hook pre-commit

View File

@ -1,9 +1,8 @@
#!/bin/bash
branch=`git rev-parse --abbrev-ref HEAD`
script_dir="$(dirname "$(readlink -f "$0")")"
cd $script_dir
if [[ $branch == "master" ]]; then
schema_dir=../resources/schema
example_dir=../examples
for example_subdir in $example_dir/*
@ -19,5 +18,3 @@ if [[ $branch == "master" ]]; then
fi
done
done
fi
exit 0

9
scripts/validate_examples_hook Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
branch=`git rev-parse --abbrev-ref HEAD`
script_dir="$(dirname "$(readlink -f "$0")")"
cd $script_dir
if [[ $branch == "master" ]]; then
./validate_examples
fi