Commit 646b891d authored by Chuck Atkins's avatar Chuck Atkins Committed by Brad King

Make all hook references relative to thier location

Some hooks were getting referenced directly via $GIT_DIR/hooks while at
other times getting referenced relative via ${BASH_SOURCE%/*}.  By making
all references relative then these hooks can reside in a different folder
and still be daisy-chained by other hooks.
parent 5ebbe2da
......@@ -131,7 +131,7 @@ gerrit_error() {
}
gerrit_hook() {
"$GIT_DIR/hooks/gerrit/commit-msg" "$@" ||
"$HOOKS_DIR/gerrit/commit-msg" "$@" ||
die 'gerrit/commit-msg failed'
}
......@@ -145,5 +145,5 @@ esac
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
. "$GIT_DIR/hooks/hooks-chain.bash"
. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain commit-msg "$@"
......@@ -22,4 +22,7 @@ fi
# Load hooks configuration from source tree.
config=".hooks-config.bash" && test -r "$config" && . "$config"
# Set up the location for "this" set of hooks.
HOOKS_DIR="${BASH_SOURCE%/*}"
# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
......@@ -322,7 +322,7 @@ test -z "$bad" || die "$bad"
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
. "$GIT_DIR/hooks/hooks-chain.bash"
. "$HOOKS_DIR/hooks-chain.bash"
hooks_chain pre-commit "$@"
# vim: set filetype=sh tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab :
......@@ -21,11 +21,11 @@
# it does not run the normal commit-msg hook.
hooks_GerritId=$(git config --get hooks.GerritId)
case "$hooks_GerritId,$2,$3" in
true,merge,) "$GIT_DIR/hooks/gerrit/commit-msg" "$1" ;;
true,merge,) "$HOOKS_DIR/gerrit/commit-msg" "$1" ;;
*) ;;
esac
#-----------------------------------------------------------------------------
# Chain to project-specific hook.
. "$GIT_DIR/hooks/hooks-chain.bash"
. "$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