diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index fb2c023d2b..f9c1ae42aa 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -451,6 +451,9 @@ class FormulaInstaller ohai "Summary" if verbose? || show_summary_heading? puts summary + + # let's reset Utils.git_available? if we just installed git + Utils.clear_git_available_cache if formula.name == "git" ensure unlock end diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 10dbc83c18..74ad49ffe7 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -21,5 +21,11 @@ module Utils rescue raise "Git is unavailable" end + + raise "Git is unavailable" unless git_available? + end + + def self.clear_git_available_cache + remove_instance_variable(:@git) if instance_variable_defined?(:@git) end end