Commit bc59a5d0 authored by Stan Hu's avatar Stan Hu

Merge branch 'dm-git-hook-popen' into 'master'

Only set cwd on the newly spawned process, instead of the current one

See merge request gitlab-org/gitlab-ce!16958
parents 3f3b84e0 81b5ce11
......@@ -82,15 +82,21 @@ module Gitlab
def call_update_hook(gl_id, gl_username, oldrev, newrev, ref)
Dir.chdir(repo_path) do
env = {
'GL_ID' => gl_id,
'GL_USERNAME' => gl_username
'GL_USERNAME' => gl_username,
'PWD' => repo_path
options = {
chdir: repo_path
stdout, stderr, status = Open3.capture3(env, path, ref, oldrev, newrev)
args = [ref, oldrev, newrev]
stdout, stderr, status = Open3.capture3(env, path, *args, options)
[status.success?, (stderr.presence || stdout).gsub(/\R/, "<br>").html_safe]
def retrieve_error_message(stderr, stdout)
err_message =
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment