diff options
author | Valery Sizov <valery@gitlab.com> | 2015-11-30 20:22:00 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-11-30 22:05:35 +0300 |
commit | 49db8b7970a62dccf63d091b853ae5c9a9ac6784 (patch) | |
tree | 5d86c1aab18c023da1d83850bc22f6626e88400a /lib | |
parent | 45f15602c25784ada70bfb2d3c6047c272735105 (diff) |
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.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 |