mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
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.
This commit is contained in:
@@ -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.'
|
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
|
if test -z "$HOOKS_ALLOW_KWSYS"; then
|
||||||
# Disallow changes to KWSys
|
# Disallow changes to KWSys
|
||||||
|
@@ -11,3 +11,7 @@ Utilities/GitSetup/tips
|
|||||||
# Rebase master by default
|
# Rebase master by default
|
||||||
git config rebase.stat true
|
git config rebase.stat true
|
||||||
git config branch.master.rebase 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}
|
||||||
|
Reference in New Issue
Block a user