summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2016-09-14 16:15:26 +0300
committerValery Sizov <valery@gitlab.com>2016-09-15 08:51:55 +0300
commit718572245724b20126a87bfb9653a566393548ec (patch)
tree7e9fd10f2249ac1747a86f0fa4b976a9cbd7b292
parent0a8b66302c2869a369a3a563c7093939487a2b25 (diff)
downloadgitlab-ce-fix_custom_hook_envs.tar.gz
Clean environment variables when running git hooksfix_custom_hook_envs
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab/git/hook.rb12
2 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 35ef11bb30c..e410d73d1f6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -135,6 +135,7 @@ v 8.12.0 (unreleased)
- Return 204 instead of 404 for /ci/api/v1/builds/register.json if no builds are scheduled for a runner !6225
- Fix Gitlab::Popen.popen thread-safety issue
- Add specs to removing project (Katarzyna Kobierska Ula Budziszewska)
+ - Clean environment variables when running git hooks
v 8.11.6
- Fix unnecessary horizontal scroll area in pipeline visualizations. !6005
diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb
index 9b681e636c7..bd90d24a2ec 100644
--- a/lib/gitlab/git/hook.rb
+++ b/lib/gitlab/git/hook.rb
@@ -17,11 +17,13 @@ module Gitlab
def trigger(gl_id, oldrev, newrev, ref)
return [true, nil] 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)
+ Bundler.with_clean_env do
+ 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
end