summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAgis Anastasopoulos <corestudiosinc@gmail.com>2016-01-14 07:36:23 +0200
committerAgis Anastasopoulos <corestudiosinc@gmail.com>2016-01-14 07:36:23 +0200
commit2513bd223de3716c2c8911b41c1f9461c7af7e97 (patch)
treeebc5426ef018e44afbb3203d509178f0311d0460
parent9cb0cfd8e9437b21729e98e64f37080043ed7b8b (diff)
downloadbundler-2513bd223de3716c2c8911b41c1f9461c7af7e97.tar.gz
Uncolored output in GitProxy#branch
Fixes #4056.
-rw-r--r--lib/bundler/source/git/git_proxy.rb2
-rw-r--r--spec/install/gemfile/git_spec.rb25
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index edf7924f5f..a9f782e8d6 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -64,7 +64,7 @@ module Bundler
def branch
@branch ||= allowed_in_path do
- git("branch") =~ /^\* (.*)$/ && $1.strip
+ git("rev-parse --abbrev-ref HEAD").strip
end
end
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index ad1e7736da..ba7e439066 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -996,4 +996,29 @@ describe "bundle install with git sources" do
expect(exitstatus).to be_zero if exitstatus
end
end
+
+ describe "when the git source is overriden with a local git repo" do
+ before do
+ bundle "config --global local.foo #{lib_path("foo")}"
+ end
+
+ describe "and git output is colorized" do
+ before do
+ File.open("#{ENV["HOME"]}/.gitconfig", "w") do |f|
+ f.write("[color]\n\tui = always\n")
+ end
+ end
+
+ it "installs successfully" do
+ build_git "foo", "1.0", :path => lib_path("foo")
+
+ gemfile <<-G
+ gem "foo", :git => "#{lib_path("foo")}", :branch => "master"
+ G
+
+ bundle :install
+ should_be_installed "foo 1.0"
+ end
+ end
+ end
end