fix(version): Add friendly error message when remote branch is missing #1741
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.
Fix for a cryptic error that
lerna version
currently throws when the branch is missing in the remote.Description
If the current branch doesn't exist in the remote, lerna throws the following error:
This PR adds a check when
lerna version
is ran, so that it is verified first that the remote branch exists. If it doesn't exist, a new ValidationError (EMISSREMOTEBRANCH) will be thrown, i.e.:Branch 'foo' doesn't exist in remote 'origin'. If this is a new branch, please make sure you push it to the remote first.
Motivation and Context
The existing error thrown when the remote branch doesn't exist is misleading and doesn't make sense in the context of
lerna version
.How Has This Been Tested?
Added unit tests and integration tests. I've also tested it manually, environment:
MacBook Pro macOS High Sierra
node v9.8.0
git 2.15.2
Types of changes
Checklist: