Commit c2bf1061 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

link post-receive hook also

parent 4908b894
#!/usr/bin/env bash
# Version 4.1
# This file was placed here by GitLab. It makes sure that your pushed commits
# will be processed properly.
while read oldrev newrev ref
do
# For every branch or tag that was pushed, create a Resque job in redis.
repo_path=`pwd`
env -i redis-cli rpush "resque:gitlab:queue:post_receive" "{\"class\":\"PostReceive\",\"args\":[\"$repo_path\",\"$oldrev\",\"$newrev\",\"$ref\",\"$GL_USER\"]}" > /dev/null 2>&1
done
...@@ -10,6 +10,7 @@ class GitlabProjects ...@@ -10,6 +10,7 @@ class GitlabProjects
@project_name = ARGV.shift @project_name = ARGV.shift
@repos_path = GitlabConfig.new.repos_path @repos_path = GitlabConfig.new.repos_path
@full_path = File.join(@repos_path, @project_name) @full_path = File.join(@repos_path, @project_name)
@hook_path = File.join(ROOT_PATH, 'hooks', 'post-receive')
end end
def exec def exec
...@@ -24,8 +25,8 @@ class GitlabProjects ...@@ -24,8 +25,8 @@ class GitlabProjects
protected protected
def add_project def add_project
FileUtils.mkdir_p(@full_path, mode: 0770 ) FileUtils.mkdir_p(@full_path, mode: 0770)
cmd = "cd #{@full_path} && git init --bare" cmd = "cd #{@full_path} && git init --bare && ln -s #{@hook_path} #{@full_path}/hooks/post-receive"
system(cmd) system(cmd)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment