Homebrew.git_*: check git available
This commit is contained in:
parent
aae5b4f721
commit
31ddce85e7
@ -150,27 +150,32 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.git_origin
|
def self.git_origin
|
||||||
|
return unless Utils.git_available?
|
||||||
HOMEBREW_REPOSITORY.cd { `git config --get remote.origin.url 2>/dev/null`.chuzzle }
|
HOMEBREW_REPOSITORY.cd { `git config --get remote.origin.url 2>/dev/null`.chuzzle }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.git_head
|
def self.git_head
|
||||||
|
return unless Utils.git_available?
|
||||||
HOMEBREW_REPOSITORY.cd { `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle }
|
HOMEBREW_REPOSITORY.cd { `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.git_short_head
|
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 }
|
HOMEBREW_REPOSITORY.cd { `git rev-parse --short=4 --verify -q HEAD 2>/dev/null`.chuzzle }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.git_last_commit
|
def self.git_last_commit
|
||||||
|
return unless Utils.git_available?
|
||||||
HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle }
|
HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.git_last_commit_date
|
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 }
|
HOMEBREW_REPOSITORY.cd { `git show -s --format="%cd" --date=short HEAD 2>/dev/null`.chuzzle }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.homebrew_version_string
|
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
|
last_commit = git_last_commit_date
|
||||||
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
|
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user