Skip to content

Commit

Permalink
ENH: Simplify local Git hook chaining
Browse files Browse the repository at this point in the history
Add ".hooks-config.bash" to tell the main hooks to chain to our hooks.
Remove the hard-coded "git config" hook chaining.  The new approach is
better because the chaining configuration is versioned with the hooks
that it chains.

Change-Id: I4a3add10395d1113611394d40d2efe9b5210dd4b
  • Loading branch information
bradking committed Feb 7, 2012
1 parent e12d00e commit 9b6be0e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.git* export-ignore
.hooks* export-ignore
.mailmap export-ignore

*.bat -crlf
Expand Down
24 changes: 24 additions & 0 deletions .hooks-config.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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.txt
#
# 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.
#
#==========================================================================*/

# 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/Hooks/pre-commit"
hooks_chain_commit_msg="Utilities/Hooks/commit-msg"
hooks_chain_prepare_commit_msg="Utilities/Hooks/prepare-commit-msg"
6 changes: 0 additions & 6 deletions Utilities/DevelopmentSetupScripts/SetupHooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,4 @@ git config hooks.KWStyle.conf "Utilities/KWStyle/ITK.kws.xml.in"
git config hooks.KWStyle.overwriteRulesConf "Utilities/KWStyle/ITKOverwrite.txt"
git config hooks.KWStyle true

# Set up hook chaining.
echo "Setting up ITK hook chaining: prepare-commit-msg, commit-msg, pre-commit"
git config hooks.chain-prepare-commit-msg Utilities/Hooks/prepare-commit-msg
git config hooks.chain-commit-msg Utilities/Hooks/commit-msg
git config hooks.chain-pre-commit Utilities/Hooks/pre-commit

echo "Done."

0 comments on commit 9b6be0e

Please sign in to comment.