diff options
author | Paul Okstad <pokstad@gitlab.com> | 2019-02-27 01:28:19 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2019-02-27 01:28:19 +0300 |
commit | 4640fcfd55ff44a3e6535421dbd40ac192d31473 (patch) | |
tree | 4ab015645b596fab4c67de56ab34f73574d593e4 | |
parent | d25fc68b147316bb13886c8567a7c4f3313365ad (diff) | |
parent | ad96aba86f0356c8ec8cfa5e821c3d621d570e8a (diff) |
Merge branch 'update-hook-env' into 'master'
Pass GL_PROTOCOL and GL_REPOSITORY to update hook
Closes gitlab-ce#43739
See merge request gitlab-org/gitaly!1082
-rw-r--r-- | changelogs/unreleased/update-hook-env.yml | 5 | ||||
-rw-r--r-- | ruby/lib/gitlab/git/hook.rb | 7 | ||||
-rw-r--r-- | ruby/spec/lib/gitlab/git/hook_spec.rb | 2 | ||||
-rw-r--r-- | ruby/spec/test_repo_helper.rb | 2 |
4 files changed, 11 insertions, 5 deletions
diff --git a/changelogs/unreleased/update-hook-env.yml b/changelogs/unreleased/update-hook-env.yml new file mode 100644 index 000000000..59b642ae5 --- /dev/null +++ b/changelogs/unreleased/update-hook-env.yml @@ -0,0 +1,5 @@ +--- +title: Pass GL_PROTOCOL and GL_REPOSITORY to update hook +merge_request: 1082 +author: +type: fixed diff --git a/ruby/lib/gitlab/git/hook.rb b/ruby/lib/gitlab/git/hook.rb index f89f88ff1..1b2979cc2 100644 --- a/ruby/lib/gitlab/git/hook.rb +++ b/ruby/lib/gitlab/git/hook.rb @@ -45,10 +45,7 @@ module Gitlab exit_status = false exit_message = nil - vars = env_base_vars(gl_id, gl_username).merge( - 'GL_PROTOCOL' => GL_PROTOCOL, - 'GL_REPOSITORY' => repository.gl_repository - ) + vars = env_base_vars(gl_id, gl_username) options = { chdir: repo_path @@ -104,6 +101,8 @@ module Gitlab 'GITLAB_SHELL_DIR' => Gitlab.config.gitlab_shell.path, 'GL_ID' => gl_id, 'GL_USERNAME' => gl_username, + 'GL_REPOSITORY' => repository.gl_repository, + 'GL_PROTOCOL' => GL_PROTOCOL, 'PWD' => repo_path, 'GIT_DIR' => repo_path } diff --git a/ruby/spec/lib/gitlab/git/hook_spec.rb b/ruby/spec/lib/gitlab/git/hook_spec.rb index 402980704..2e1551ba1 100644 --- a/ruby/spec/lib/gitlab/git/hook_spec.rb +++ b/ruby/spec/lib/gitlab/git/hook_spec.rb @@ -34,6 +34,8 @@ describe Gitlab::Git::Hook do { 'GL_ID' => 'user-123', 'GL_USERNAME' => 'janedoe', + 'GL_REPOSITORY' => repo.gl_repository, + 'GL_PROTOCOL' => 'web', 'PWD' => repo.path, 'GIT_DIR' => repo.path, 'GITLAB_SHELL_DIR' => '/foobar/gitlab-shell' diff --git a/ruby/spec/test_repo_helper.rb b/ruby/spec/test_repo_helper.rb index 411f0bf40..2ff26ff5c 100644 --- a/ruby/spec/test_repo_helper.rb +++ b/ruby/spec/test_repo_helper.rb @@ -78,7 +78,7 @@ module TestRepo Gitlab::Git::Repository.new( gitaly_repo, repo_path_from_gitaly(gitaly_repo), - '', + 'project-123', gitlab_projects, '' ) |