Commit 3bde0fa9 authored by Brad King's avatar Brad King

hooks-chain: Look for chains in project hooks config

If a local hook chain rule is not in the local git configuration
check for a value defined in .hooks-config.bash:

  hooks_chain_pre_commit
  hooks_chain_commit_msg
  hooks_chain_prepare_commit_msg

This allows project to configure chained hooks without adding any
values to the local git configuration.  Since the project hooks
config can be versioned with the hook scripts it references this
ensures a consistent state.
parent 18358af3
......@@ -16,7 +16,9 @@
hooks_chain() {
hook="$1" ; shift
chain=$(git config --get hooks.chain-$hook) || return 0
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="" ;;
......
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