summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcommit-msg3
-rw-r--r--hooks-config.bash6
-rwxr-xr-xpre-commit3
-rwxr-xr-xprepare-commit-msg3
4 files changed, 15 insertions, 0 deletions
diff --git a/commit-msg b/commit-msg
index b0006fa91a..1ca1c75732 100755
--- a/commit-msg
+++ b/commit-msg
@@ -17,6 +17,9 @@
. "${BASH_SOURCE%/*}/hooks-config.bash"
+# Start with project-specific hook.
+hooks_start commit-msg "$@"
+
# Prepare a copy of the message:
# - strip comment lines
# - stop at "diff --git" (git commit -v)
diff --git a/hooks-config.bash b/hooks-config.bash
index 1da984ddfc..afdbf9dd7d 100644
--- a/hooks-config.bash
+++ b/hooks-config.bash
@@ -43,6 +43,12 @@ hooks_chain() {
hooks_child "$chain" "$@" || exit
}
+hooks_start() {
+ hook="$1" ; shift
+ start="$(hooks_config --get hooks.start.$hook)"
+ hooks_child "$start" "$@" || exit
+}
+
hooks_child() {
child="$1" ; shift
test -n "$child" || return 0
diff --git a/pre-commit b/pre-commit
index 5fe22bf54d..6496b45c7f 100755
--- a/pre-commit
+++ b/pre-commit
@@ -17,6 +17,9 @@
. "${BASH_SOURCE%/*}/hooks-config.bash"
+# Start with project-specific hook.
+hooks_start pre-commit "$@"
+
die() {
echo 'pre-commit hook failure' 1>&2
echo '-----------------------' 1>&2
diff --git a/prepare-commit-msg b/prepare-commit-msg
index 9d3383909f..4de7f13f73 100755
--- a/prepare-commit-msg
+++ b/prepare-commit-msg
@@ -17,6 +17,9 @@
. "${BASH_SOURCE%/*}/hooks-config.bash"
+# Start with project-specific hook.
+hooks_start prepare-commit-msg "$@"
+
# Invoke the Gerrit Change-Id hook here for "git merge" because
# it does not run the normal commit-msg hook.
hooks_GerritId=$(git config --get hooks.GerritId)