Skip to content

Allow consumers to point git binary via env var #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2019

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Aug 2, 2019

Your checklist for this pull request

🚨Please review the guidelines for contributing to this repository.

  • Ensure all commits include DCO sign-off.
  • Ensure that your contributions pass unit testing.
  • Ensure that your contributions contain documentation if applicable.

Description

By adding a new environment variable called GIT_PATH we can allow
consumers, that is, a user of a gem that the gem itself uses the git gem,
to customize the location of the git binary.

Example: Having a gem called git-tool that uses this gem git, if I,
as a user wants to modify the git bin location, I could do:

GIT_PATH=/foo/bin git-tool bar

Signed-off-by: Salim Afiune afiune@chef.io

@afiune
Copy link
Contributor Author

afiune commented Aug 6, 2019

@perlun and @tarcinil -- this PR is ready for review.

@@ -10,7 +10,7 @@ def initialize
end

def binary_path
@binary_path || 'git'
@binary_path || ENV['GIT_BIN'] || 'git'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about GIT_PATH instead? Or GIT_BINARY? (I would prefer the first option, but interested in hearing your opinions also.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, pointing to the actual binary is the best way to give users the flexibility that they need. Though I can see the confusion since the method name is binary_path. I could rename the function if that makes it more clear since it is not returning the path of the binary but the binary itself.

What do you think @perlun?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afiune Thanks. I was just thinking about changing the environment variable name, sorry for not being so clear here. 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at your change now. I think GIT_PATH would be the clearer way. Sorry for being slightly picky, but please change the env variable to that and I'll be happy to get this merged ASAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I’ll make the change, update the tests and documentation. 💯

@afiune
Copy link
Contributor Author

afiune commented Sep 4, 2019

I just renamed the environment variable as you suggested, I can change the behavior to provide the path is this is what you think is best for the users. Open to suggestions.

@afiune
Copy link
Contributor Author

afiune commented Sep 8, 2019

@perlun Ready to merge! 💯

tenor-50737593

Copy link
Contributor

@perlun perlun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍 Thanks. Please just get the commits squashed into one (and edit the commit message to be what you want it to be in the repo) and I'll get this merged.

By adding a new environment variable called `GIT_PATH` we can allow
consumers, that is, a user of a gem that the gem itself uses the git gem,
to customize the location of the git binary.

Example: Having a gem called `git-tool` that uses this gem `git`, if I,
as a user wants to modify the git bin location, I could do:
```
GIT_PATH=/foo/bin git-tool bar
```

Signed-off-by: Salim Afiune <afiune@chef.io>
@afiune afiune force-pushed the afiune/git-bin-env-variable branch from cab28f2 to 4988861 Compare September 12, 2019 18:02
@afiune
Copy link
Contributor Author

afiune commented Sep 12, 2019

@perlun done done done!!

tenor-138074943

@afiune
Copy link
Contributor Author

afiune commented Sep 16, 2019

@perlun ping 😅

@perlun
Copy link
Contributor

perlun commented Sep 20, 2019

Looks good @afiune! Sorry for the delays on this. Merging now.

@perlun perlun merged commit 2402674 into ruby-git:master Sep 20, 2019
AgoraSecurity pushed a commit to AgoraSecurity/ruby-git that referenced this pull request Feb 21, 2020
By adding a new environment variable called `GIT_PATH` we can allow
consumers, that is, a user of a gem which itself uses the git gem,
to customize the location of the git binary.

Example: Having a gem called `git-tool` that uses this gem `git`, if I,
as a user wants to modify the git bin location, I could do:
```
GIT_PATH=/foo/bin git-tool bar
```

Signed-off-by: Salim Afiune <afiune@chef.io>Signed-off-by: Agora Security <github@agora-security.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants