Add support for global custom hooks and chained hook directories
This is continuation of PR#245 from GitHub and !89 (closed) addressing #32 (closed)
With changes of mine:
- process per project hooks
<repository>.git/custom_hooks/<hook_name>.d/*
as<repository>.git/custom_hooks
is local dir for<repository>.git
- process global hooks from
<repository>.git/hooks/<hook_name>.d/*
because<repository>.git/hooks
is symlink togitlab-shell/hooks
the hooks matched by shell glob must be:
- executable (
+x
bit set) - not matching editor backup files (
*~
)
the overview of the whole process:
-
<repository>.git/hooks/
- symlink togitlab-shell/hooks
global dir -
<repository>.git/hooks/<hook_name>
- executed bygit
itself, this isgitlab-shell/hooks/<hook_name>
-
<repository>.git/custom_hooks/<hook_name>
- per project hook (this is already existing behavior) -
<repository>.git/custom_hooks/<hook_name>.d/*
- per project hooks -
<repository>.git/hooks/<hook_name>.d/*
- global hooks: all executable files (minus editor backup files)
the files matched by glob are also sorted so if order of hooks is important, one can name their hooks as:
- 01-hook1.sh
- 02-hook2.pl
- 03-hook3.py
Docs MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6721