From bc380e48486903637ec9da977ad2d5bab3dc9dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 6 Oct 2016 17:50:47 +0000 Subject: [PATCH] Update custom_hooks.md for global custom hooks and chained hook info https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/93 --- doc/administration/custom_hooks.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/administration/custom_hooks.md b/doc/administration/custom_hooks.md index 0387d7304892..06291705702b 100644 --- a/doc/administration/custom_hooks.md +++ b/doc/administration/custom_hooks.md @@ -42,6 +42,25 @@ Follow the steps below to set up a custom hook: That's it! Assuming the hook code is properly implemented the hook will fire as appropriate. +## Chained hooks support + +> [Introduced][93] in GitLab Shell 4.1.0. + +The hooks could be also placed in `hooks/.d` (global) or `custom_hooks/.d` (per project) +directories supporting chained execution of the hooks. + +The hooks are searched and executed in this order: +1. `.git/hooks/` - symlink to `gitlab-shell/hooks` global dir +1. `.git/hooks/` - executed by `git` itself, this is `gitlab-shell/hooks/` +1. `.git/custom_hooks/` - per project hook (this is already existing behavior) +1. `.git/custom_hooks/.d/*` - per project hooks +1. `.git/hooks/.d/*` - global hooks: all executable files (minus editor backup files) + +Files in `.d` directories need to be executable and not match the backup file pattern (`*~`). + +The hooks of the same type are executed in order and execution stops on the first +script exiting with non-zero value. + ## Custom error messages > [Introduced][5073] in GitLab 8.10. @@ -54,3 +73,4 @@ STDERR takes precedence over STDOUT. [hooks]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#Server-Side-Hooks [5073]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5073 +[93]: https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/93 -- GitLab