diff options
| author | Jack Nagel | 2014-06-30 19:15:03 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-06-30 19:18:28 -0500 |
| commit | 8591250e860129e9173f93ce24905bbb1e225232 (patch) | |
| tree | c13707d71b20a29e05e0292fecd2a5aa35868edf | |
| parent | 5dff180c11e29a6c2471147cfbfdfc2c8c0648e0 (diff) | |
| download | homebrew-8591250e860129e9173f93ce24905bbb1e225232.tar.bz2 | |
Add a method for getting the repo HEAD
| -rw-r--r-- | Library/Homebrew/cmd/config.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/tab.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 4 |
3 files changed, 6 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index 9ee9cace2..133e01439 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -44,10 +44,7 @@ module Homebrew end def head - head = HOMEBREW_REPOSITORY.cd do - `git rev-parse --verify -q HEAD 2>/dev/null`.chomp - end - if head.empty? then "(none)" else head end + Homebrew.git_head || "(none)" end def origin diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 52b74e5c9..b5bd8a2ad 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -14,10 +14,6 @@ class Tab < OpenStruct build = f.build.dup build.args = args - sha = HOMEBREW_REPOSITORY.cd do - `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle - end - Tab.new :used_options => build.used_options, :unused_options => build.unused_options, :tabfile => f.prefix.join(FILENAME), @@ -25,7 +21,7 @@ class Tab < OpenStruct :poured_from_bottle => false, :tapped_from => f.tap, :time => Time.now.to_i, - :HEAD => sha, + :HEAD => Homebrew.git_head, :compiler => compiler, :stdlib => stdlib end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 6684b3696..eae5c922e 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -112,6 +112,10 @@ module Homebrew Process.wait(pid) $?.success? end + + def self.git_head + HOMEBREW_REPOSITORY.cd { `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle } + end end def with_system_path |
