Skip to content

Commit

Permalink
Merge pull request #1076 from MikeMcQuaid/homebrew-version-git-describe
Browse files Browse the repository at this point in the history
Use git describe to get the HOMEBREW_VERSION.
  • Loading branch information
MikeMcQuaid authored Sep 22, 2016
2 parents 9784fa4 + f0e9292 commit 6353750
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/brew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require "global"

if ARGV == %w[--version] || ARGV == %w[-v]
puts "Homebrew #{Homebrew.homebrew_version_string}"
puts "Homebrew #{HOMEBREW_VERSION}"
puts "Homebrew/homebrew-core #{Homebrew.core_tap_version_string}"
exit 0
end
Expand Down
6 changes: 5 additions & 1 deletion Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
HOMEBREW_VERSION="1.0.0"
HOMEBREW_VERSION="$(git describe --tags --dirty 2>/dev/null)"
if [[ -z "$HOMEBREW_VERSION" ]]
then
HOMEBREW_VERSION=">1.0.0 (no git repository)"
fi

onoe() {
if [[ -t 2 ]] # check whether stderr is a tty.
Expand Down
9 changes: 0 additions & 9 deletions Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,6 @@ def self.system(cmd, *args)
_system(cmd, *args)
end

def self.homebrew_version_string
if pretty_revision = HOMEBREW_REPOSITORY.git_short_head
last_commit = HOMEBREW_REPOSITORY.git_last_commit_date
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
else
"#{HOMEBREW_VERSION} (no git repository)"
end
end

def self.core_tap_version_string
require "tap"
tap = CoreTap.instance
Expand Down

0 comments on commit 6353750

Please sign in to comment.