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.
Previously, a lot of the git helpers silently swallowed if the git command exited non-zero, which tended to hide some pretty severe bugs in consuming packages (such as beachball, see microsoft/beachball#780).
This PR updates almost all of the git helpers to explicitly throw errors if the git command exits non-zero. I think this approach is preferable because it likely indicates invalid input to the command or an invalid repo state, and either of those is something that should be explicitly surfaced (so it can be fixed) rather than hidden.
I considered adding a flag to each helper that determines whether to throw, but I think in almost all cases, throwing by default is preferable. If anyone has a use case for needing one of the helpers not to throw (which can't be covered by try/catch on the consumer end), they can open an issue.