File tree 2 files changed +18
-5
lines changed
2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,21 @@ module Git
2
2
3
3
class Config
4
4
5
- attr_writer :binary_path
6
-
7
- attr_accessor :git_ssh
5
+ attr_writer :binary_path , :git_ssh
8
6
9
7
def initialize
10
8
@binary_path = nil
9
+ @git_ssh = nil
11
10
end
12
11
13
12
def binary_path
14
13
@binary_path || 'git'
15
14
end
16
15
16
+ def git_ssh
17
+ @git_ssh || ENV [ 'GIT_SSH' ]
18
+ end
19
+
17
20
end
18
21
19
22
end
Original file line number Diff line number Diff line change @@ -29,13 +29,23 @@ def test_set_config
29
29
end
30
30
31
31
def test_env_config
32
+ assert_equal ( Git ::Base . config . git_ssh , nil )
33
+
34
+ ENV [ 'GIT_SSH' ] = '/env/git/ssh'
35
+
36
+ assert_equal ( Git ::Base . config . git_ssh , '/env/git/ssh' )
37
+
32
38
Git . configure do |config |
33
- config . binary_path = " /usr/bin/git"
34
- config . git_ssh = " /path/to/ssh/script"
39
+ config . binary_path = ' /usr/bin/git'
40
+ config . git_ssh = ' /path/to/ssh/script'
35
41
end
42
+
43
+ assert_equal ( Git ::Base . config . git_ssh , '/path/to/ssh/script' )
36
44
37
45
@git . log
38
46
ensure
47
+ ENV [ 'GIT_SSH' ] = nil
48
+
39
49
Git . configure do |config |
40
50
config . binary_path = nil
41
51
config . git_ssh = nil
You can’t perform that action at this time.
0 commit comments