diff options
author | Brad King <brad.king@kitware.com> | 2017-02-01 14:16:14 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-02-01 14:16:14 (GMT) |
commit | d6113e958a501af2f5c88f343fb8507710b638e5 (patch) | |
tree | 332598068dfdac206c7b245ee362bdf2e854c471 | |
parent | 1f8da86115b6333b803feb769341fbfa171fbcc9 (diff) | |
parent | 3288ab0c78057e2388b247d326dc80011488a0bb (diff) | |
download | CMake-d6113e958a501af2f5c88f343fb8507710b638e5.zip CMake-d6113e958a501af2f5c88f343fb8507710b638e5.tar.gz CMake-d6113e958a501af2f5c88f343fb8507710b638e5.tar.bz2 |
Merge topic 'developer-setup'
3288ab0c Convert local hook configuration to a Git config file format
773df0e2 Add pre-commit hook to check whether SetupForDevelopment must re-run
-rw-r--r-- | .hooks-config (renamed from .hooks-config.bash) | 7 | ||||
-rwxr-xr-x | Utilities/Git/pre-commit | 13 | ||||
-rwxr-xr-x | Utilities/SetupForDevelopment.sh | 4 |
3 files changed, 21 insertions, 3 deletions
diff --git a/.hooks-config.bash b/.hooks-config index ea9342a..064371c 100644 --- a/.hooks-config.bash +++ b/.hooks-config @@ -4,6 +4,7 @@ # Loaded by .git/hooks/(pre-commit|commit-msg|prepare-commit-msg) # during git commit after local hooks have been installed. -hooks_chain_pre_commit="Utilities/Git/pre-commit" -hooks_chain_commit_msg="Utilities/Git/commit-msg" -hooks_chain_prepare_commit_msg="Utilities/Git/prepare-commit-msg" +[hooks "chain"] + pre-commit = Utilities/Git/pre-commit + commit-msg = Utilities/Git/commit-msg + prepare-commit-msg = Utilities/Git/prepare-commit-msg 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} |