diff options
Diffstat (limited to 'app/services/git_hooks_service.rb')
-rw-r--r-- | app/services/git_hooks_service.rb | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/app/services/git_hooks_service.rb b/app/services/git_hooks_service.rb deleted file mode 100644 index d222d1e63aa..00000000000 --- a/app/services/git_hooks_service.rb +++ /dev/null @@ -1,32 +0,0 @@ -class GitHooksService - PreReceiveError = Class.new(StandardError) - - attr_accessor :oldrev, :newrev, :ref - - def execute(user, repo_path, oldrev, newrev, ref) - @repo_path = repo_path - @user = Gitlab::GlId.gl_id(user) - @oldrev = oldrev - @newrev = newrev - @ref = ref - - %w(pre-receive update).each do |hook_name| - status, message = run_hook(hook_name) - - unless status - raise PreReceiveError, message - end - end - - yield(self).tap do - run_hook('post-receive') - end - end - - private - - def run_hook(name) - hook = Gitlab::Git::Hook.new(name, @repo_path) - hook.trigger(@user, oldrev, newrev, ref) - end -end |