summaryrefslogtreecommitdiff
path: root/hooks/post-receive
blob: 50981585b7138ff557036357b7b3fb3cfc605554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby

# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.

refs = $stdin.read
key_id = ENV.delete('GL_ID')
gl_repository = ENV['GL_REPOSITORY']
repo_path = Dir.pwd

require_relative '../lib/gitlab_custom_hook'
require_relative '../lib/hooks_utils'
require_relative '../lib/gitlab_post_receive'

push_opts = HooksUtils.get_push_options

if GitlabPostReceive.new(gl_repository, repo_path, key_id, refs, push_opts).exec &&
    GitlabCustomHook.new(repo_path, key_id).post_receive(refs)
  exit 0
else
  exit 1
end