Commit 2d9ee2a9 authored by Brad King's avatar Brad King

hooks-config: Subsume hooks-chain functionality

Remove hooks-chain.bash and place its content in hooks-config.bash.
parent 646b891d
......@@ -145,5 +145,4 @@ esac
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain commit-msg "$@"
#=============================================================================
# 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 :
......@@ -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 :
......@@ -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 :
......@@ -27,5 +27,4 @@ esac
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain prepare-commit-msg "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment