blob: 4e8d607096cb758358555f44552905e2eb6446b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# frozen_string_literal: true
module SystemCheck
module App
class GitConfigCheck < SystemCheck::BaseCheck
OPTIONS = {
'core.autocrlf' => 'input'
}.freeze
set_name 'Git configured correctly?'
def check?
correct_options = OPTIONS.map do |name, value|
run_command(%W(#{Gitlab.config.git.bin_path} config --global --get #{name})).try(:squish) == value
end
correct_options.all?
end
# Tries to configure git itself
#
# Returns true if all subcommands were successful (according to their exit code)
# Returns false if any or all subcommands failed.
def repair!
return false unless gitlab_user?
command_success = OPTIONS.map do |name, value|
system(*%W(#{Gitlab.config.git.bin_path} config --global #{name} #{value}))
end
command_success.all?
end
def show_error
try_fixing_it(
sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global core.autocrlf \"#{OPTIONS['core.autocrlf']}\"")
)
for_more_information(
see_installation_guide_section 'GitLab'
)
end
end
end
end
|