in files/gitlab-cookbooks/gitaly/libraries/gitaly.rb [139:220]
def parse_gitconfig
return unless Gitlab['gitaly'].dig('configuration', 'git', 'config').nil?
return if Gitlab['omnibus_gitconfig']['system'].nil?
omnibus_gitconfig = Gitlab['omnibus_gitconfig']['system'].flat_map do |section, entries|
entries.map do |entry|
key, value = entry.split('=', 2)
raise "Invalid entry detected in omnibus_gitconfig['system']: '#{entry}' should be in the form key=value" if key.nil? || value.nil?
"#{section}.#{key.strip}=#{value.strip}"
end
end
omnibus_gitconfig -= [
'pack.threads=1',
'receive.advertisePushOptions=true',
'receive.fsckObjects=true',
'repack.writeBitmaps=true',
'transfer.hideRefs=^refs/tmp/',
'transfer.hideRefs=^refs/keep-around/',
'transfer.hideRefs=^refs/remotes/',
'core.alternateRefsCommand="exit 0 #"',
'core.fsyncObjectFiles=true',
'fetch.writeCommitGraph=true'
]
gitaly_gitconfig = omnibus_gitconfig.map do |config|
section_subsection_and_key, value = config.split('=', 2)
key, section_and_subsection = section_subsection_and_key.reverse.split('.', 2)
key.reverse!
section, subsection = section_and_subsection.reverse!.split(' ', 2)
subsection&.gsub!(/\A"|"\Z/, '')
{ 'section' => section, 'subsection' => subsection, 'key' => key, 'value' => value }
end
return unless gitaly_gitconfig.any?
tmp_source_hash = {
configuration: {
git: {
config: gitaly_gitconfig.map do |entry|
{
key: [entry['section'], entry['subsection'], entry['key']].compact.join('.'),
value: entry['value']
}
end
}
}
}
Chef::Mixin::DeepMerge.deep_merge!(tmp_source_hash, Gitlab['gitaly'])
end