Avoid “Failure while executing; git config --replace-all homebrew.devcmdrun true exited with 255.” error.
				
					
				
			This commit is contained in:
		
							parent
							
								
									813f75159b
								
							
						
					
					
						commit
						2eaca98505
					
				@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user