Skip to content

Commit 14738bb

Browse files
ericTsiliacosrobertodecurnex
authored andcommitted
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 <frankkotsianas@gmail.com>
1 parent cc6d6ef commit 14738bb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/units/test_lib.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,29 @@ def test_environment_reset
6666
assert_equal(ENV['GIT_INDEX_FILE'],'my_index')
6767
end
6868

69+
def test_git_ssh_from_environment_is_passed_to_binary
70+
ENV['GIT_SSH'] = 'my/git-ssh-wrapper'
71+
72+
Dir.mktmpdir do |dir|
73+
output_path = File.join(dir, 'git_ssh_value')
74+
binary_path = File.join(dir, 'git')
75+
Git::Base.config.binary_path = binary_path
76+
File.open(binary_path, 'w') { |f|
77+
f << "echo $GIT_SSH > #{output_path}"
78+
}
79+
FileUtils.chmod(0700, binary_path)
80+
@lib.checkout('something')
81+
assert_equal("my/git-ssh-wrapper\n", File.read(output_path))
82+
end
83+
ensure
84+
Git.configure do |config|
85+
config.binary_path = nil
86+
config.git_ssh = nil
87+
end
88+
89+
ENV['GIT_SSH'] = nil
90+
end
91+
6992
def test_revparse
7093
assert_equal('1cc8667014381e2788a94777532a788307f38d26', @lib.revparse('1cc8667014381')) # commit
7194
assert_equal('94c827875e2cadb8bc8d4cdd900f19aa9e8634c7', @lib.revparse('1cc8667014381^{tree}')) #tree

0 commit comments

Comments
 (0)