summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-04-03 01:08:12 -0700
committerAndre Arko <andre@arko.net>2010-04-03 01:08:12 -0700
commitf69931f12d20a089caba6574d9a9224f8092d2a0 (patch)
treeb9b3f51a23ab26ba16cd4f0efe7d9d421b0575f5
parent6f45141732f13706ec0118ad92cd35e5ed1f4c40 (diff)
downloadbundler-f69931f12d20a089caba6574d9a9224f8092d2a0.tar.gz
Don't print git gem shas twice during bundle show
-rw-r--r--lib/bundler/rubygems_ext.rb4
-rw-r--r--spec/other/show_spec.rb10
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