diff options
| author | Xu Cheng | 2015-09-08 15:09:15 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-09-09 12:19:16 +0800 |
| commit | 4529df1246a8db82ee07c4945f62b801ba6bf655 (patch) | |
| tree | 80cceb7d4a1196e4bc8c966ac52806adde8c630a /Library/Homebrew/utils/git.rb | |
| parent | 1b531492cac1af458506f6535ecc97137cabbc91 (diff) | |
| download | brew-4529df1246a8db82ee07c4945f62b801ba6bf655.tar.bz2 | |
git_available?: cache the result
Diffstat (limited to 'Library/Homebrew/utils/git.rb')
| -rw-r--r-- | Library/Homebrew/utils/git.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 53057cd10..774a0a65f 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -1,11 +1,12 @@ module Utils def self.git_available? + return @git if instance_variable_defined?(:@git) git = which("git") # git isn't installed by older Xcodes - return false if git.nil? + return @git = false if git.nil? # /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out - return false if git == "/usr/bin/git" && !OS::Mac.has_apple_developer_tools? - true + return @git = false if git == "/usr/bin/git" && !OS::Mac.has_apple_developer_tools? + @git = true end def self.ensure_git_installed! |
