Load local hooks configuration from work tree

Look for a ".hooks-config.bash" file at the top of the work tree.
Load it in each hook to get per-project configuration.  Currently
we do not define any config options, but this adds the framework.
This commit is contained in:
Brad King 2011-10-06 17:56:05 -04:00
parent e8180f209b
commit 18358af310
4 changed files with 26 additions and 0 deletions

@ -35,6 +35,8 @@ die() {
exit 1
}
. "$GIT_DIR/hooks/hooks-config.bash"
#-----------------------------------------------------------------------------
# Check the commit message layout with a simple state machine.

20
hooks-config.bash Normal file

@ -0,0 +1,20 @@
#=============================================================================
# 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.
#=============================================================================
# Load hooks configuration from source tree.
config=".hooks-config.bash" && test -r "$config" && . "$config"
# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :

@ -23,6 +23,8 @@ die() {
exit 1
}
. "$GIT_DIR/hooks/hooks-config.bash"
zero='0000000000000000000000000000000000000000'
#-----------------------------------------------------------------------------

@ -15,6 +15,8 @@
# limitations under the License.
#=============================================================================
. "$GIT_DIR/hooks/hooks-config.bash"
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
. "$GIT_DIR/hooks/hooks-chain.bash"