diff options
| author | Xu Cheng | 2015-09-08 15:19:27 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-09-09 12:19:17 +0800 |
| commit | 31ddce85e7d37eac032e0dd80a6f45cd2ff1d4f8 (patch) | |
| tree | b4f5c85bbce2d58d705927df01bb32b51f233375 /Library | |
| parent | aae5b4f721a91ab2c9cc6c4ac25413d261d8f779 (diff) | |
| download | brew-31ddce85e7d37eac032e0dd80a6f45cd2ff1d4f8.tar.bz2 | |
Homebrew.git_*: check git available
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/utils.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index f1fd7409a..caf46d6fb 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -150,27 +150,32 @@ module Homebrew end def self.git_origin + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git config --get remote.origin.url 2>/dev/null`.chuzzle } end def self.git_head + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle } end def self.git_short_head + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git rev-parse --short=4 --verify -q HEAD 2>/dev/null`.chuzzle } end def self.git_last_commit + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle } end def self.git_last_commit_date + return unless Utils.git_available? HOMEBREW_REPOSITORY.cd { `git show -s --format="%cd" --date=short HEAD 2>/dev/null`.chuzzle } end def self.homebrew_version_string - if Utils.git_available? && (pretty_revision = git_short_head) + if pretty_revision = git_short_head last_commit = git_last_commit_date "#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})" else |
