summaryrefslogtreecommitdiff
path: root/hooks/pre-receive
blob: fe4ea4c3e22d3b50ddaef5acb0b936ed6d98fbf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env ruby

# This file was placed here by GitLab Shell.
# It is a shared file that is symlinked from all repositories.
# It makes sure that your pushed commits will be processed properly.
# You can add your own hooks to by uncommenting the lines at the bottom.
# If you upgrade GitLab Shell you will have to redo your changes.
# In GitLab Enterprise Edition you can use Git Hooks instead.
# See http://doc.gitlab.com/ee/git_hooks/git_hooks.html

refs = ARGF.read
key_id  = ENV['GL_ID']
repo_path = Dir.pwd

require_relative '../lib/gitlab_access'

if GitlabAccess.new(repo_path, key_id, refs).exec
  exit 0
else
  exit 1
end

## How to add a custom hooks to some repositories:
## 1) Put a file with custom code in the repository root directory.
## 2) Uncomment the lines below.
## 3) Replace 'project-specific-hook' with the name if the custom file.
#
# if File.exists?('project-specific-hook')
#   execute 'project-specific-hook'
# end