File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments