diff options
author | Valery Sizov <valery@gitlab.com> | 2015-11-30 17:22:00 +0000 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-11-30 17:22:00 +0000 |
commit | 13c6096e42e5b20039f78b9415bea82e1f2507eb (patch) | |
tree | bed2f1dd8bdeedfd1c412ef458218097af6da083 /lib | |
parent | ceeb93fa77783a3fa9a60529195cd187af191bba (diff) | |
parent | ae18ba16327abd79cf6207b83209d4ef96d3e158 (diff) | |
download | gitlab-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.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 |