diff options
Diffstat (limited to 'hooks/pre-receive')
-rwxr-xr-x | hooks/pre-receive | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hooks/pre-receive b/hooks/pre-receive index 66cb97d..09fa42b 100755 --- a/hooks/pre-receive +++ b/hooks/pre-receive @@ -9,10 +9,16 @@ protocol = ENV.delete('GL_PROTOCOL') repo_path = Dir.pwd require_relative '../lib/gitlab_custom_hook' +require_relative '../lib/gitlab_reference_counter' require_relative '../lib/gitlab_access' +# It's important that on pre-receive `increase_reference_counter` gets executed +# last so that it only runs if everything else succeeded. On post-receive on the +# other hand, we run GitlabPostReceive first because the push is already done +# and we don't want to skip it if the custom hook fails. if GitlabAccess.new(repo_path, key_id, refs, protocol).exec && - GitlabCustomHook.new.pre_receive(refs, repo_path) + GitlabCustomHook.new.pre_receive(refs, repo_path) && + GitlabReferenceCounter.new(repo_path).increase exit 0 else exit 1 |