From 3638c057f08d346a64a34016bdacc26a37baf330 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Tue, 8 Sep 2015 16:24:09 +0800 Subject: [PATCH] FormulaInstaller: reset git_available? when installing git Closes Homebrew/homebrew#43693 Signed-off-by: Xu Cheng --- Library/Homebrew/formula_installer.rb | 3 +++ Library/Homebrew/utils/git.rb | 6 ++++++ 2 files changed, 9 insertions(+) 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