From 14738bba33463e62cb43d52c2b5d9b7f6a1b3474 Mon Sep 17 00:00:00 2001 From: Eric Tsiliacos Date: Tue, 13 Jan 2015 14:34:52 -0800 Subject: [PATCH] fix git ssh env usage v1.2.8 allowed setting of GIT_SSH to point to SSH wrapper; v1.2.9 overrides this with value of Git::Base.config.git_ssh. This is our story in our backlog: https://www.pivotaltracker.com/story/show/86059268. Signed-off-by: Frank Kotsianas --- tests/units/test_lib.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/units/test_lib.rb b/tests/units/test_lib.rb index 1b236133..403a2877 100644 --- a/tests/units/test_lib.rb +++ b/tests/units/test_lib.rb @@ -66,6 +66,29 @@ def test_environment_reset assert_equal(ENV['GIT_INDEX_FILE'],'my_index') end + def test_git_ssh_from_environment_is_passed_to_binary + ENV['GIT_SSH'] = 'my/git-ssh-wrapper' + + Dir.mktmpdir do |dir| + output_path = File.join(dir, 'git_ssh_value') + binary_path = File.join(dir, 'git') + Git::Base.config.binary_path = binary_path + File.open(binary_path, 'w') { |f| + f << "echo $GIT_SSH > #{output_path}" + } + FileUtils.chmod(0700, binary_path) + @lib.checkout('something') + assert_equal("my/git-ssh-wrapper\n", File.read(output_path)) + end + ensure + Git.configure do |config| + config.binary_path = nil + config.git_ssh = nil + end + + ENV['GIT_SSH'] = nil + end + def test_revparse assert_equal('1cc8667014381e2788a94777532a788307f38d26', @lib.revparse('1cc8667014381')) # commit assert_equal('94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', @lib.revparse('1cc8667014381^{tree}')) #tree