Merge pull request #36420 from smbkr/push-ask-upstream

Git - Ask to publish branch if there is no upstream
This commit is contained in:
João Moreno
2017-12-12 16:55:56 +01:00
committed by GitHub
2 changed files with 25 additions and 2 deletions

View File

@@ -317,7 +317,8 @@ export const GitErrorCodes = {
BranchAlreadyExists: 'BranchAlreadyExists',
NoLocalChanges: 'NoLocalChanges',
NoStashFound: 'NoStashFound',
LocalChangesOverwritten: 'LocalChangesOverwritten'
LocalChangesOverwritten: 'LocalChangesOverwritten',
NoUpstreamBranch: 'NoUpstreamBranch'
};
function getGitErrorCode(stderr: string): string | undefined {
@@ -945,6 +946,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;