From 773df0e2d7596d84a711914f1cffb4fb5a107c17 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Jan 2017 10:51:46 -0500 Subject: Add pre-commit hook to check whether SetupForDevelopment must re-run Add a version number to the `SetupForDevelopment.sh` script and use a pre-commit hook to check when it changes. --- Utilities/Git/pre-commit | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Utilities/Git') diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit index b232ac0a5d..b63ae5e337 100755 --- a/Utilities/Git/pre-commit +++ b/Utilities/Git/pre-commit @@ -29,6 +29,19 @@ die 'The following changes add lines too long for our C++ style: Use lines strictly less than '"$line_too_long"' characters in C++ code.' +#----------------------------------------------------------------------------- + +# Check that development setup is up-to-date. +lastSetupForDevelopment=$(git config --get hooks.SetupForDevelopment || echo 0) +eval $(grep '^SetupForDevelopment_VERSION=' "${BASH_SOURCE%/*}/../SetupForDevelopment.sh") +test -n "$SetupForDevelopment_VERSION" || SetupForDevelopment_VERSION=0 +if test $lastSetupForDevelopment -lt $SetupForDevelopment_VERSION; then + die 'Developer setup in this work tree is out of date. Please re-run + + Utilities/SetupForDevelopment.sh +' +fi + #------------------------------------------------------------------------------- if test -z "$HOOKS_ALLOW_KWSYS"; then # Disallow changes to KWSys -- cgit v1.2.1