Merge pull request #11230 from reitermarkus/git-config-error
This commit is contained in:
commit
fb7d19c661
@ -17,28 +17,27 @@ module Homebrew
|
|||||||
def read(setting, repo: HOMEBREW_REPOSITORY)
|
def read(setting, repo: HOMEBREW_REPOSITORY)
|
||||||
return unless (repo/".git/config").exist?
|
return unless (repo/".git/config").exist?
|
||||||
|
|
||||||
repo.cd do
|
system_command("git", args: ["config", "--get", "homebrew.#{setting}"], chdir: repo).stdout.chomp.presence
|
||||||
Utils.popen_read("git", "config", "--get", "homebrew.#{setting}").chomp.presence
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(setting: T.any(String, Symbol), value: T.any(String, T::Boolean), repo: Pathname).void }
|
sig { params(setting: T.any(String, Symbol), value: T.any(String, T::Boolean), repo: Pathname).void }
|
||||||
def write(setting, value, repo: HOMEBREW_REPOSITORY)
|
def write(setting, value, repo: HOMEBREW_REPOSITORY)
|
||||||
return unless (repo/".git/config").exist?
|
return unless (repo/".git/config").exist?
|
||||||
|
|
||||||
repo.cd do
|
value = value.to_s
|
||||||
system_command! "git", args: ["config", "--replace-all", "homebrew.#{setting}", value.to_s]
|
|
||||||
end
|
return if read(setting, repo: repo) == value
|
||||||
|
|
||||||
|
system_command! "git", args: ["config", "--replace-all", "homebrew.#{setting}", value], chdir: repo
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(setting: T.any(String, Symbol), repo: Pathname).void }
|
sig { params(setting: T.any(String, Symbol), repo: Pathname).void }
|
||||||
def delete(setting, repo: HOMEBREW_REPOSITORY)
|
def delete(setting, repo: HOMEBREW_REPOSITORY)
|
||||||
return unless (repo/".git/config").exist?
|
return unless (repo/".git/config").exist?
|
||||||
|
|
||||||
return if read(setting, repo: repo).blank?
|
return if read(setting, repo: repo).blank?
|
||||||
|
|
||||||
repo.cd do
|
system_command! "git", args: ["config", "--unset-all", "homebrew.#{setting}"], chdir: repo
|
||||||
system_command! "git", args: ["config", "--unset-all", "homebrew.#{setting}"]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user