diff --git a/.gitignore b/.gitignore index bcaa1569dd..9286aae13e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ std-gram.ext tools/sections *.synctex.gz *.synctex* +.check.stamp diff --git a/source/Makefile b/source/Makefile index d4a2ff4064..25fdcf505c 100644 --- a/source/Makefile +++ b/source/Makefile @@ -30,3 +30,12 @@ clean-examples: rm -f $(EXAMPLES) examples: $(EXAMPLES) + +check: .check.stamp + +.check.stamp: ../tools/check-source.sh *.tex + @echo "Running tools/check-source.sh" + @../tools/check-source.sh + @touch $@ + +.PHONY: default refresh refresh full quiet clean-figures figures clean-examples examples check diff --git a/tools/gitconfig.sh b/tools/gitconfig.sh index 9a6d697447..b0488b1b9e 100755 --- a/tools/gitconfig.sh +++ b/tools/gitconfig.sh @@ -1,3 +1,16 @@ #!/bin/sh git config diff.orderFile .gitorder git config diff.c++draft.xfuncname '\\rSec[0-9]+(\[.*\])\{' + +precommit="$(git rev-parse --git-dir)/hooks/pre-commit" + +test -f "${precommit}" && exit +read -p "Install 'make check' pre-commit hook? [Y/n] " hook +if [ -z "${hook}" -o "${hook}" = "y" -o "${hook}" = "Y" ]; then + cat < "${precommit}" +#!/bin/sh +cd \$(git rev-parse --show-toplevel)/source +make check +EOF + chmod +x "${precommit}" +fi