IssueID #1104: separated git hook from command script (so it can be run independently)
This commit is contained in:
parent
47802a3577
commit
d9eab477fd
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
top_dir=`git rev-parse --show-toplevel`
|
top_dir=`git rev-parse --show-toplevel`
|
||||||
cd $top_dir/.git/hooks
|
cd $top_dir/.git/hooks
|
||||||
ln -s ../../scripts/validate_examples pre-commit
|
ln -s ../../scripts/validate_examples_hook pre-commit
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
branch=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
script_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
cd $script_dir
|
cd $script_dir
|
||||||
if [[ $branch == "master" ]]; then
|
|
||||||
schema_dir=../resources/schema
|
schema_dir=../resources/schema
|
||||||
example_dir=../examples
|
example_dir=../examples
|
||||||
for example_subdir in $example_dir/*
|
for example_subdir in $example_dir/*
|
||||||
do
|
do
|
||||||
base=${example_subdir##*/}
|
base=${example_subdir##*/}
|
||||||
schema=$schema_dir/$base.xsd
|
schema=$schema_dir/$base.xsd
|
||||||
for example_file in $example_subdir/*.xml
|
for example_file in $example_subdir/*.xml
|
||||||
|
@ -18,6 +17,4 @@ if [[ $branch == "master" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
|
|
9
scripts/validate_examples_hook
Executable file
9
scripts/validate_examples_hook
Executable 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
|
Loading…
Reference in New Issue
Block a user