diff options
author | Agis Anastasopoulos <corestudiosinc@gmail.com> | 2016-01-14 07:36:23 +0200 |
---|---|---|
committer | Agis Anastasopoulos <corestudiosinc@gmail.com> | 2016-01-14 07:36:23 +0200 |
commit | 2513bd223de3716c2c8911b41c1f9461c7af7e97 (patch) | |
tree | ebc5426ef018e44afbb3203d509178f0311d0460 | |
parent | 9cb0cfd8e9437b21729e98e64f37080043ed7b8b (diff) | |
download | bundler-2513bd223de3716c2c8911b41c1f9461c7af7e97.tar.gz |
Uncolored output in GitProxy#branch
Fixes #4056.
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/git_spec.rb | 25 |
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 |