summaryrefslogtreecommitdiffstats
path: root/Utilities/Git/pre-commit
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-10-24 14:36:15 (GMT)
committerBrad King <brad.king@kitware.com>2011-10-24 14:40:59 (GMT)
commitb2d6adf1266554de222fd438e9501c1eb67b429a (patch)
tree8866059c26e24e7e89467cd3ffa30164ab1777e2 /Utilities/Git/pre-commit
parent3d5869ca3c065c872d6365164b301d2f8d7e2b64 (diff)
downloadCMake-b2d6adf1266554de222fd438e9501c1eb67b429a.zip
CMake-b2d6adf1266554de222fd438e9501c1eb67b429a.tar.gz
CMake-b2d6adf1266554de222fd438e9501c1eb67b429a.tar.bz2
pre-commit: Reject changes to KWSys through Git
Explain in the rejection message why KWSys cannot be changed in Git.
Diffstat (limited to 'Utilities/Git/pre-commit')
-rwxr-xr-xUtilities/Git/pre-commit28
1 files changed, 26 insertions, 2 deletions
diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit
index e4f9fd0..110e9ee 100755
--- a/Utilities/Git/pre-commit
+++ b/Utilities/Git/pre-commit
@@ -19,5 +19,29 @@ die() {
exit 1
}
-# This is a placeholder for future pre-commit checks.
-exit 0
+if test -z "$HOOKS_ALLOW_KWSYS"; then
+ # Disallow changes to KWSys
+ files=$(git diff-index --name-only --cached HEAD -- Source/kwsys) &&
+ if test -n "$files"; then
+ die 'Changes to KWSys files
+
+'"$(echo "$files" | sed 's/^/ /')"'
+
+cannot be committed through Git. KWSys is kept in a CVS repository
+shared by several projects. A robot replays changes committed there
+into the Source/kwsys directory in CMake. Please send changes to
+this directory separately. Run
+
+ git reset HEAD -- Source/kwsys
+
+to unstage these changes and then
+
+ git diff -- Source/kwsys > kwsys.patch
+
+to construct the patch. Alternatively, set environment variable
+
+ HOOKS_ALLOW_KWSYS=1
+
+to disable this check and commit the changes locally.'
+ fi
+fi