summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-04-04 13:12:19 -0400
committerBrad King <brad.king@kitware.com>2013-04-04 13:26:20 -0400
commit2d9ee2a97cb41c505692d39aa172ed074c98c48e (patch)
treee25bec8412cee47591f7bcebac644ead227a2483
parent646b891d70dc244bebd0a5738626168292a16f6f (diff)
downloadcmake-2d9ee2a97cb41c505692d39aa172ed074c98c48e.tar.gz
hooks-config: Subsume hooks-chain functionality
Remove hooks-chain.bash and place its content in hooks-config.bash.
-rwxr-xr-xcommit-msg1
-rw-r--r--hooks-chain.bash33
-rw-r--r--hooks-config.bash16
-rwxr-xr-xpre-commit1
-rwxr-xr-xprepare-commit-msg1
5 files changed, 16 insertions, 36 deletions
diff --git a/commit-msg b/commit-msg
index 238407ffac..b0006fa91a 100755
--- a/commit-msg
+++ b/commit-msg
@@ -145,5 +145,4 @@ esac
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
-. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain commit-msg "$@"
diff --git a/hooks-chain.bash b/hooks-chain.bash
deleted file mode 100644
index 7aca6ce952..0000000000
--- a/hooks-chain.bash
+++ /dev/null
@@ -1,33 +0,0 @@
-#=============================================================================
-# Copyright 2010-2011 Kitware, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#=============================================================================
-
-hooks_chain() {
- hook="$1" ; shift
- chain=$(git config --get hooks.chain-$hook) ||
- eval chain="\${hooks_chain_${hook//-/_}}"
- test -n "$chain" || return 0
- case "$chain" in
- '/'*) prefix="" ;;
- '[A-Za-z]:/'*) prefix="" ;;
- '.'*) prefix="" ;;
- *) prefix="./" ;;
- esac
- if test -x "$prefix$chain" ; then
- exec "$prefix$chain" "$@"
- fi
-}
-
-# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/hooks-config.bash b/hooks-config.bash
index adc35fd7b7..c857c8e4a4 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -25,4 +25,20 @@ config=".hooks-config.bash" && test -r "$config" && . "$config"
# Set up the location for "this" set of hooks.
HOOKS_DIR="${BASH_SOURCE%/*}"
+hooks_chain() {
+ hook="$1" ; shift
+ chain=$(git config --get hooks.chain-$hook) ||
+ eval chain="\${hooks_chain_${hook//-/_}}"
+ test -n "$chain" || return 0
+ case "$chain" in
+ '/'*) prefix="" ;;
+ '[A-Za-z]:/'*) prefix="" ;;
+ '.'*) prefix="" ;;
+ *) prefix="./" ;;
+ esac
+ if test -x "$prefix$chain" ; then
+ exec "$prefix$chain" "$@"
+ fi
+}
+
# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/pre-commit b/pre-commit
index 9d7563444c..5fe22bf54d 100755
--- a/pre-commit
+++ b/pre-commit
@@ -322,7 +322,6 @@ test -z "$bad" || die "$bad"
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
-. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain pre-commit "$@"
# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
diff --git a/prepare-commit-msg b/prepare-commit-msg
index a5d459252e..9d3383909f 100755
--- a/prepare-commit-msg
+++ b/prepare-commit-msg
@@ -27,5 +27,4 @@ esac
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
-. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain prepare-commit-msg "$@"