Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
fix git ssh env usage
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ericTsiliacos authored and robertodecurnex committed Jan 15, 2015
1 parent cc6d6ef commit 14738bb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/units/test_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14738bb

Please sign in to comment.