Skip to content

Commit cab28f2

Browse files
author
Salim Afiune
committed
Reimplement environment variable, use GIT_PATH
Instead of using `GIT_BINARY` we prefare the environment variable `GIT_PATH` Signed-off-by: Salim Afiune <afiune@chef.io>
1 parent 6a8025b commit cab28f2

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ Git env config
6666
# If you need to use a custom SSH script
6767
config.git_ssh = '/path/to/ssh/script'
6868
end
69-
7069
```
7170

72-
_NOTE: Another way to specify where is the `git` binary is through the environment variable `GIT_BINARY`_
73-
71+
_NOTE: Another way to specify where is the `git` binary is through the environment variable `GIT_PATH`_
7472

7573
Here are the operations that need read permission only.
7674

lib/git/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def initialize
1010
end
1111

1212
def binary_path
13-
@binary_path || ENV['GIT_BINARY'] || 'git'
13+
@binary_path || ENV['GIT_PATH'] && File.join(ENV['GIT_PATH'], 'git') || 'git'
1414
end
1515

1616
def git_ssh

tests/units/test_config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_env_config
3434
assert_equal(Git::Base.config.binary_path, 'git')
3535
assert_equal(Git::Base.config.git_ssh, nil)
3636

37-
ENV['GIT_BINARY'] = '/env/bin/git'
37+
ENV['GIT_PATH'] = '/env/bin'
3838
ENV['GIT_SSH'] = '/env/git/ssh'
3939

4040
assert_equal(Git::Base.config.binary_path, '/env/bin/git')
@@ -51,7 +51,7 @@ def test_env_config
5151
@git.log
5252
ensure
5353
ENV['GIT_SSH'] = nil
54-
ENV['GIT_BINARY'] = nil
54+
ENV['GIT_PATH'] = nil
5555

5656
Git.configure do |config|
5757
config.binary_path = nil

0 commit comments

Comments
 (0)