From 96b95a838a9a74f157f7aa99f5da8238e4b87928 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 12 May 2018 21:13:17 +0100 Subject: [PATCH 1/2] Fix brew pull with git commit.gpgsign enabled Because of environment filtering, git tries to sign the commit but can't find gpg, which means that the patch won't be applied. --- Library/Homebrew/dev-cmd/pull.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 3947846963..00adee83a7 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -102,6 +102,18 @@ module Homebrew ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] 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 + end + end + do_bump = @args.bump? && !@args.clean? # Formulae with affected bottles that were published From bdfbc70c8774432a74d13e88af6b55a4a2453a30 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 22 May 2018 23:35:50 +0200 Subject: [PATCH 2/2] pull: only add gpg to path if enabled in git --- Library/Homebrew/dev-cmd/pull.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index 00adee83a7..e497792106 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -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