Ask to publish branch if there is no upstream

This commit is contained in:
Stuart Baker
2017-10-17 14:38:08 +01:00
parent 828dd97c2d
commit 3afbdb4126
2 changed files with 26 additions and 3 deletions

View File

@@ -290,7 +290,8 @@ export const GitErrorCodes = {
NoRemoteReference: 'NoRemoteReference',
NoLocalChanges: 'NoLocalChanges',
NoStashFound: 'NoStashFound',
LocalChangesOverwritten: 'LocalChangesOverwritten'
LocalChangesOverwritten: 'LocalChangesOverwritten',
NoUpstreamBranch: 'NoUpstreamBranch'
};
function getGitErrorCode(stderr: string): string | undefined {
@@ -841,6 +842,8 @@ export class Repository {
err.gitErrorCode = GitErrorCodes.PushRejected;
} else if (/Could not read from remote repository/.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.RemoteConnectionError;
} else if (/^fatal: The current branch .* has no upstream branch/.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.NoUpstreamBranch;
}
throw err;