summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-11-30 17:22:00 +0000
committerValery Sizov <valery@gitlab.com>2015-11-30 17:22:00 +0000
commit13c6096e42e5b20039f78b9415bea82e1f2507eb (patch)
treebed2f1dd8bdeedfd1c412ef458218097af6da083 /lib
parentceeb93fa77783a3fa9a60529195cd187af191bba (diff)
parentae18ba16327abd79cf6207b83209d4ef96d3e158 (diff)
downloadgitlab-ce-13c6096e42e5b20039f78b9415bea82e1f2507eb.tar.gz
Merge branch 'upload_hook' into 'master'
Fire update hook from GitLab https://gitlab.com/gitlab-org/gitlab-ce/issues/3069 See merge request !1882
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/hook.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb
index dd393fe09d2..07b856ca64c 100644
--- a/lib/gitlab/git/hook.rb
+++ b/lib/gitlab/git/hook.rb
@@ -16,6 +16,17 @@ module Gitlab
def trigger(gl_id, oldrev, newrev, ref)
return true unless exists?
+ case name
+ when "pre-receive", "post-receive"
+ call_receive_hook(gl_id, oldrev, newrev, ref)
+ when "update"
+ call_update_hook(gl_id, oldrev, newrev, ref)
+ end
+ end
+
+ private
+
+ def call_receive_hook(gl_id, oldrev, newrev, ref)
changes = [oldrev, newrev, ref].join(" ")
# function will return true if succesful
@@ -54,6 +65,12 @@ module Gitlab
exit_status
end
+
+ def call_update_hook(gl_id, oldrev, newrev, ref)
+ Dir.chdir(repo_path) do
+ system({ 'GL_ID' => gl_id }, path, ref, oldrev, newrev)
+ end
+ end
end
end
end