diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-11-24 13:35:07 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-11-30 18:36:34 +0200 |
commit | ae18ba16327abd79cf6207b83209d4ef96d3e158 (patch) | |
tree | 5a1a398cd123428af85c292d988cf04e33c91ce7 /lib | |
parent | a8e05cec000f3d2b17b966115c9d7b69629498db (diff) | |
download | gitlab-ce-ae18ba16327abd79cf6207b83209d4ef96d3e158.tar.gz |
Fire update hook from GitLab
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/hook.rb | 17 |
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 |