Commit 154f474b authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'reduce-parse-options-complexity' into 'master'

Refactor parse_options() in push_options.rb

Closes #67091

See merge request gitlab-org/gitlab-ce!32756
parents 1eeee0dd 4aa4449e
......@@ -56,19 +56,23 @@ module Gitlab
next if [namespace, key].any?(&:nil?)
options[namespace] ||= HashWithIndifferentAccess.new
if option_multi_value?(namespace, key)
options[namespace][key] ||= HashWithIndifferentAccess.new(0)
options[namespace][key][value] += 1
else
options[namespace][key] = value
end
store_option_info(options, namespace, key, value)
end
options
end
def store_option_info(options, namespace, key, value)
options[namespace] ||= HashWithIndifferentAccess.new
if option_multi_value?(namespace, key)
options[namespace][key] ||= HashWithIndifferentAccess.new(0)
options[namespace][key][value] += 1
else
options[namespace][key] = value
end
end
def option_multi_value?(namespace, key)
MULTI_VALUE_OPTIONS.any? { |arr| arr == [namespace, key] }
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