This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
Indicate git is unavailable; don't error out #1823
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
This solves a number of issues of the form of #1782
Sometimes git is necessary; other times it's just a nice-to-have. When we make API calls, we use git to check the CLI sha. While it would be nice to have, we can live without it when it's unavailable; it's not worth the DX impact. Hence, we already introduced the
ShopifyCLI::Git::available?
method.However, this method doesn't check properly, as the underlying
Open3::capture2e
will raise an error if the underlying executable isn't available at all. (For other errors, it will actually return output and a process status as expected.) This has resulted in cryptic errors when git isn't available on the system and the user just wants to make an API call.On my local system, intentionally making a typo to demonstrate an unavailable executable:
WHAT is this pull request doing?
Adds a
rescue
for the case that thegit
executable isn't present. This is OK because the purpose of theavailable?
method is only used where we don't absolutely require git.How to test your changes?
git
isn't installedUpdate checklist