diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-16 15:37:02 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-16 15:37:02 +0300 |
commit | 980423f6da0640c8ab8f35c2d56466502f54faef (patch) | |
tree | 93f57cc5463158f9a5b25d17c080ae424e21c7d6 /lib | |
parent | 03699653d6946a4b6ee178214d864d1add4f5cf1 (diff) | |
parent | e73af42239cde041d9cfc323b9c3e004f205fe1a (diff) |
Merge branch 'git-env-handle-arrays' into 'master'
Add Gitlab::Git::Env.to_env_hash
See merge request gitlab-org/gitlab-ce!14841
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/env.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/git/rev_list.rb | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/git/env.rb b/lib/gitlab/git/env.rb index 80f0731cd99..9d0b47a1a6d 100644 --- a/lib/gitlab/git/env.rb +++ b/lib/gitlab/git/env.rb @@ -30,6 +30,17 @@ module Gitlab RequestStore.fetch(:gitlab_git_env) { {} } end + def self.to_env_hash + env = {} + + all.compact.each do |key, value| + value = value.join(File::PATH_SEPARATOR) if value.is_a?(Array) + env[key.to_s] = value + end + + env + end + def self.[](key) all[key] end diff --git a/lib/gitlab/git/rev_list.rb b/lib/gitlab/git/rev_list.rb index 92a6a672534..60b2a4ec411 100644 --- a/lib/gitlab/git/rev_list.rb +++ b/lib/gitlab/git/rev_list.rb @@ -28,7 +28,7 @@ module Gitlab private def execute(args) - output, status = popen(args, nil, Gitlab::Git::Env.all.stringify_keys) + output, status = popen(args, nil, Gitlab::Git::Env.to_env_hash) unless status.zero? raise "Got a non-zero exit code while calling out `#{args.join(' ')}`: #{output}" |