diff options
author | Valery Sizov <valery@gitlab.com> | 2016-07-04 15:30:22 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-07-04 15:31:49 +0300 |
commit | bf218337ed5bd535856204ef1878a1495fa37dfe (patch) | |
tree | 66415495c994a17fb0c45bcfcb4a3d08d808098f /lib | |
parent | 021b6aef94b3398ab5603b4c11afd4c6d8432795 (diff) |
Better message for git hooks and file locks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/hook.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb index 07b856ca64c..5415f4844d3 100644 --- a/lib/gitlab/git/hook.rb +++ b/lib/gitlab/git/hook.rb @@ -29,8 +29,8 @@ module Gitlab def call_receive_hook(gl_id, oldrev, newrev, ref) changes = [oldrev, newrev, ref].join(" ") - # function will return true if succesful exit_status = false + exit_message = nil vars = { 'GL_ID' => gl_id, @@ -41,7 +41,7 @@ module Gitlab chdir: repo_path } - Open3.popen2(vars, path, options) do |stdin, _, wait_thr| + Open3.popen3(vars, path, options) do |stdin, _, stderr, wait_thr| exit_status = true stdin.sync = true @@ -60,16 +60,21 @@ module Gitlab unless wait_thr.value == 0 exit_status = false + exit_message = stderr.gets end end - exit_status + [exit_status, exit_message] end def call_update_hook(gl_id, oldrev, newrev, ref) + status = nil + Dir.chdir(repo_path) do - system({ 'GL_ID' => gl_id }, path, ref, oldrev, newrev) + status = system({ 'GL_ID' => gl_id }, path, ref, oldrev, newrev) end + + [status, nil] end end end |