aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorJoseph Frazier2016-01-05 21:25:04 -0500
committerMartin Afanasjew2016-01-08 15:56:43 +0100
commit91d4ba7158f3d8fc32b2a668cd1153a0d6971087 (patch)
treee0b2a772e83f13555720be7c21a83c9d98716158 /Library/Homebrew/cmd
parent5162df8f65c7189206d951fe6fcef325740e2a76 (diff)
downloadbrew-91d4ba7158f3d8fc32b2a668cd1153a0d6971087.tar.bz2
update: abbreviate hashes to at least 7 characters
Abbreviations will be longer if needed to preserve uniqueness. This makes it more consistent with `git rev-parse --short`, https://github.com/Homebrew/homebrew/commits, etc. For example, instead of: Updated Homebrew from 40d1e9c2 to 90b9bdf4. We see: Updated Homebrew from 40d1e9c to 90b9bdf. See 0c48248b6555353c8d60b61973639c8423ce586c for the original introduction of eight-character abbreviations.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/update.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 436175b25..f93224c8d 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -41,8 +41,9 @@ module Homebrew
master_updater.pull!
master_updated = master_updater.updated?
if master_updated
- puts "Updated Homebrew from #{master_updater.initial_revision[0, 8]} " \
- "to #{master_updater.current_revision[0, 8]}."
+ initial_short = shorten_revision(master_updater.initial_revision)
+ current_short = shorten_revision(master_updater.current_revision)
+ puts "Updated Homebrew from #{initial_short} to #{current_short}."
end
report.update(master_updater.report)
@@ -133,6 +134,10 @@ module Homebrew
private
+ def shorten_revision(revision)
+ `git rev-parse --short #{revision}`.chomp
+ end
+
def git_init_if_necessary
if Dir[".git/*"].empty?
safe_system "git", "init"