diff options
author | Brad King <brad.king@kitware.com> | 2017-01-31 15:51:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-01-31 16:16:10 (GMT) |
commit | 773df0e2d7596d84a711914f1cffb4fb5a107c17 (patch) | |
tree | cb901382513b3045bd49518ea3d17a0b98c9d29e /Utilities | |
parent | 8a76536e78e9084fb9636b2f0c57121522cfbbaf (diff) | |
download | CMake-773df0e2d7596d84a711914f1cffb4fb5a107c17.zip CMake-773df0e2d7596d84a711914f1cffb4fb5a107c17.tar.gz CMake-773df0e2d7596d84a711914f1cffb4fb5a107c17.tar.bz2 |
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.
Diffstat (limited to 'Utilities')
-rwxr-xr-x | Utilities/Git/pre-commit | 13 | ||||
-rwxr-xr-x | Utilities/SetupForDevelopment.sh | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit index b232ac0..b63ae5e 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 diff --git a/Utilities/SetupForDevelopment.sh b/Utilities/SetupForDevelopment.sh index 0a9df7e..39152bc 100755 --- a/Utilities/SetupForDevelopment.sh +++ b/Utilities/SetupForDevelopment.sh @@ -11,3 +11,7 @@ Utilities/GitSetup/tips # Rebase master by default git config rebase.stat true git config branch.master.rebase true + +# Record the version of this setup so Git/pre-commit can check it. +SetupForDevelopment_VERSION=1 +git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION} |