summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-10-25 19:34:30 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-10-25 19:34:30 (GMT)
commit7b555c0295222be2cd70dd60b5c1b52a890f668c (patch)
tree1bed8eb6a8670128838de681d4b9b668803f46dd
parentbd216ef63a57ed7cc868885f8796e3eab9355a8d (diff)
parentb2d6adf1266554de222fd438e9501c1eb67b429a (diff)
downloadCMake-7b555c0295222be2cd70dd60b5c1b52a890f668c.zip
CMake-7b555c0295222be2cd70dd60b5c1b52a890f668c.tar.gz
CMake-7b555c0295222be2cd70dd60b5c1b52a890f668c.tar.bz2
Merge topic 'local-hooks'
b2d6adf pre-commit: Reject changes to KWSys through Git 3d5869c Add pre-commit|commit-msg|prepare-commit-msg hook placeholders
-rw-r--r--.gitattributes1
-rw-r--r--.hooks-config.bash18
-rwxr-xr-xUtilities/Git/commit-msg23
-rwxr-xr-xUtilities/Git/pre-commit47
-rwxr-xr-xUtilities/Git/prepare-commit-msg15
5 files changed, 104 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index 43676a9..d9d64d6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,4 +1,5 @@
.gitattributes export-ignore
+.hooks* export-ignore
bootstrap crlf=input
configure crlf=input
diff --git a/.hooks-config.bash b/.hooks-config.bash
new file mode 100644
index 0000000..97152f6
--- /dev/null
+++ b/.hooks-config.bash
@@ -0,0 +1,18 @@
+#=============================================================================
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# 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"
diff --git a/Utilities/Git/commit-msg b/Utilities/Git/commit-msg
new file mode 100755
index 0000000..9a5d1c1
--- /dev/null
+++ b/Utilities/Git/commit-msg
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#=============================================================================
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+die() {
+ echo 'commit-msg hook failure' 1>&2
+ echo '-----------------------' 1>&2
+ echo '' 1>&2
+ echo "$@" 1>&2
+ exit 1
+}
+
+# This is a placeholder for future commit-msg checks.
+exit 0
diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit
new file mode 100755
index 0000000..110e9ee
--- /dev/null
+++ b/Utilities/Git/pre-commit
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+#=============================================================================
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+die() {
+ echo 'pre-commit hook failure' 1>&2
+ echo '-----------------------' 1>&2
+ echo '' 1>&2
+ echo "$@" 1>&2
+ exit 1
+}
+
+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
diff --git a/Utilities/Git/prepare-commit-msg b/Utilities/Git/prepare-commit-msg
new file mode 100755
index 0000000..1517bb2
--- /dev/null
+++ b/Utilities/Git/prepare-commit-msg
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+#=============================================================================
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# This is a placeholder for future prepare-commit-msg hooks.
+exit 0