diff options
author | Andre Arko <andre@arko.net> | 2010-04-03 01:08:12 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-04-03 01:08:12 -0700 |
commit | f69931f12d20a089caba6574d9a9224f8092d2a0 (patch) | |
tree | b9b3f51a23ab26ba16cd4f0efe7d9d421b0575f5 | |
parent | 6f45141732f13706ec0118ad92cd35e5ed1f4c40 (diff) | |
download | bundler-f69931f12d20a089caba6574d9a9224f8092d2a0.tar.gz |
Don't print git gem shas twice during bundle show
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 4 | ||||
-rw-r--r-- | spec/other/show_spec.rb | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 6174646f73..f93c5ccc46 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -19,9 +19,9 @@ module Gem def git_version if @loaded_from && File.exist?(File.join(full_gem_path, ".git")) - rev = Dir.chdir(full_gem_path){ `git rev-parse HEAD`.strip } + sha = Dir.chdir(full_gem_path){ `git rev-parse HEAD`.strip } branch = full_gem_path.split("-")[3] - branch ? " #{branch}-#{rev[0...6]}" : " #{rev[0...6]}" + (branch && branch != sha) ? " #{branch}-#{sha[0...6]}" : " #{sha[0...6]}" end end diff --git a/spec/other/show_spec.rb b/spec/other/show_spec.rb index d48b7dca74..2c2936f365 100644 --- a/spec/other/show_spec.rb +++ b/spec/other/show_spec.rb @@ -65,4 +65,14 @@ describe "bundle show with a git repo" do bundle :show out.should include("foo (1.0 omg-#{@revision}") end + + it "doesn't print the branch when tied to a ref" do + sha = revision_for(lib_path("foo-1.0")) + install_gemfile <<-G + gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{sha}" + G + + bundle :show + out.should include("foo (1.0 #{sha[0...6]})") + end end
\ No newline at end of file |