Skip to content

Commit 6353750

Browse files
authored
Merge pull request #1076 from MikeMcQuaid/homebrew-version-git-describe
Use git describe to get the HOMEBREW_VERSION.
2 parents 9784fa4 + f0e9292 commit 6353750

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

Library/Homebrew/brew.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
require "global"
1515

1616
if ARGV == %w[--version] || ARGV == %w[-v]
17-
puts "Homebrew #{Homebrew.homebrew_version_string}"
17+
puts "Homebrew #{HOMEBREW_VERSION}"
1818
puts "Homebrew/homebrew-core #{Homebrew.core_tap_version_string}"
1919
exit 0
2020
end

Library/Homebrew/brew.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
HOMEBREW_VERSION="1.0.0"
1+
HOMEBREW_VERSION="$(git describe --tags --dirty 2>/dev/null)"
2+
if [[ -z "$HOMEBREW_VERSION" ]]
3+
then
4+
HOMEBREW_VERSION=">1.0.0 (no git repository)"
5+
fi
26

37
onoe() {
48
if [[ -t 2 ]] # check whether stderr is a tty.

Library/Homebrew/utils.rb

-9
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,6 @@ def self.system(cmd, *args)
248248
_system(cmd, *args)
249249
end
250250

251-
def self.homebrew_version_string
252-
if pretty_revision = HOMEBREW_REPOSITORY.git_short_head
253-
last_commit = HOMEBREW_REPOSITORY.git_last_commit_date
254-
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
255-
else
256-
"#{HOMEBREW_VERSION} (no git repository)"
257-
end
258-
end
259-
260251
def self.core_tap_version_string
261252
require "tap"
262253
tap = CoreTap.instance

0 commit comments

Comments
 (0)