Commit 48d292eb authored by Jacob Vosmaer's avatar Jacob Vosmaer

Unset GL_ID and GL_PROTOCOL immediately

Neither other code executing in the hook process nor subprocesses of
the hook process need access to the GL_ID / GL_PROTOCOL variables so
we can just unset them the moment we fetch them.
parent e8a4dc70
......@@ -4,12 +4,9 @@
# will be processed properly.
refs = $stdin.read
key_id = ENV['GL_ID']
key_id = ENV.delete('GL_ID')
repo_path = Dir.pwd
# reset GL_ID env since we already got its value
ENV['GL_ID'] = nil
require_relative '../lib/gitlab_custom_hook'
require_relative '../lib/gitlab_post_receive'
......
......@@ -4,8 +4,8 @@
# will be processed properly.
refs = $stdin.read
key_id = ENV['GL_ID']
protocol = ENV['GL_PROTOCOL']
key_id = ENV.delete('GL_ID')
protocol = ENV.delete('GL_PROTOCOL')
repo_path = Dir.pwd
require_relative '../lib/gitlab_custom_hook'
......@@ -15,8 +15,5 @@ if GitlabAccess.new(repo_path, key_id, refs, protocol).exec &&
GitlabCustomHook.new.pre_receive(refs, repo_path)
exit 0
else
# reset GL_ID env since we stop git push here
ENV['GL_ID'] = nil
exit 1
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment