summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorXavier Shay <xavier@rhnh.net>2013-08-10 17:50:44 -0700
committerXavier Shay <xavier@rhnh.net>2013-08-18 14:31:10 -0700
commitd8437838ca48b6204dffb5b9f302a37ef5026ac5 (patch)
treef55a598ceb1fa173a34e4d25e1dff09009d3d90a /spec
parent12eee6adc99fac9074c223e52c643ee59932dedf (diff)
downloadbundler-d8437838ca48b6204dffb5b9f302a37ef5026ac5.tar.gz
Ignore git path configuration in env when shelling out to git.
Diffstat (limited to 'spec')
-rw-r--r--spec/install/git_spec.rb22
-rw-r--r--spec/support/builders.rb6
2 files changed, 27 insertions, 1 deletions
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index ae9e5a145b..5c537beccd 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -875,4 +875,26 @@ describe "bundle install with git sources" do
end
end
+ it 'ignores git environment variables' do
+ build_git "xxxxxx" do |s|
+ s.executables = "xxxxxxbar"
+ end
+
+ Bundler::SharedHelpers.with_clean_git_env do
+ ENV['GIT_DIR'] = 'bar'
+ ENV['GIT_WORK_TREE'] = 'bar'
+
+ result = install_gemfile <<-G, :exitstatus => true
+ source "file://#{gem_repo1}"
+ git "#{lib_path('xxxxxx-1.0')}" do
+ gem 'xxxxxx'
+ end
+ G
+
+ expect(exitstatus).to eq(0)
+ expect(ENV['GIT_DIR']).to eq('bar')
+ expect(ENV['GIT_WORK_TREE']).to eq('bar')
+ end
+ end
+
end
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 856f0479cc..05c09a0b44 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -1,3 +1,5 @@
+require 'bundler/shared_helpers'
+
module Spec
module Builders
def self.constantize(name)
@@ -588,7 +590,9 @@ module Spec
private
def git(cmd)
- Dir.chdir(@path) { `git #{cmd}`.strip }
+ Bundler::SharedHelpers.with_clean_git_env do
+ Dir.chdir(@path) { `git #{cmd}`.strip }
+ end
end
end