pull: only add gpg to path if enabled in git

This commit is contained in:
Alyssa Ross 2018-05-22 23:35:50 +02:00
parent 96b95a838a
commit bdfbc70c87
No known key found for this signature in database
GPG Key ID: 6CF064D149E3ABDB

View File

@ -103,14 +103,16 @@ module Homebrew
end
# Depending on user configuration, git may try to invoke gpg.
begin
gnupg = Formula["gnupg"]
rescue FormulaUnavailableError # rubocop:disable Lint/HandleExceptions
else
if gnupg.installed?
path = PATH.new(ENV.fetch("PATH"))
path.prepend(gnupg.installed_prefix/"bin")
ENV["PATH"] = path
if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true"
begin
gnupg = Formula["gnupg"]
rescue FormulaUnavailableError # rubocop:disable Lint/HandleExceptions
else
if gnupg.installed?
path = PATH.new(ENV.fetch("PATH"))
path.prepend(gnupg.installed_prefix/"bin")
ENV["PATH"] = path
end
end
end