Avoid “Failure while executing; git config --replace-all homebrew.devcmdrun true exited with 255.” error.

This commit is contained in:
Markus Reiter 2021-04-22 20:46:51 +02:00
parent 813f75159b
commit 2eaca98505
No known key found for this signature in database
GPG Key ID: 245293B51702655B

View File

@ -17,28 +17,27 @@ module Homebrew
def read(setting, repo: HOMEBREW_REPOSITORY)
return unless (repo/".git/config").exist?
repo.cd do
Utils.popen_read("git", "config", "--get", "homebrew.#{setting}").chomp.presence
end
system_command("git", args: ["config", "--get", "homebrew.#{setting}"], chdir: repo).stdout.chomp.presence
end
sig { params(setting: T.any(String, Symbol), value: T.any(String, T::Boolean), repo: Pathname).void }
def write(setting, value, repo: HOMEBREW_REPOSITORY)
return unless (repo/".git/config").exist?
repo.cd do
system_command! "git", args: ["config", "--replace-all", "homebrew.#{setting}", value.to_s]
end
value = value.to_s
return if read(setting, repo: repo) == value
system_command! "git", args: ["config", "--replace-all", "homebrew.#{setting}", value], chdir: repo
end
sig { params(setting: T.any(String, Symbol), repo: Pathname).void }
def delete(setting, repo: HOMEBREW_REPOSITORY)
return unless (repo/".git/config").exist?
return if read(setting, repo: repo).blank?
repo.cd do
system_command! "git", args: ["config", "--unset-all", "homebrew.#{setting}"]
end
system_command! "git", args: ["config", "--unset-all", "homebrew.#{setting}"], chdir: repo
end
end
end