Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/github/src/pushErrorHandler.ts')
-rw-r--r--extensions/github/src/pushErrorHandler.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/extensions/github/src/pushErrorHandler.ts b/extensions/github/src/pushErrorHandler.ts
index 5948c526ea1..37f138caffb 100644
--- a/extensions/github/src/pushErrorHandler.ts
+++ b/extensions/github/src/pushErrorHandler.ts
@@ -23,7 +23,7 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
const no = localize('no', "No");
const answer = await window.showInformationMessage(localize('fork', "You don't have permissions to push to '{0}/{1}' on GitHub. Would you like to create a fork and push to it instead?", owner, repo), yes, no);
- if (answer === no) {
+ if (answer !== yes) {
return;
}
@@ -73,7 +73,9 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
await repository.renameRemote(remote.name, 'upstream');
// Issue: what if there's already another `origin` repo?
- await repository.addRemote('origin', ghRepository.clone_url);
+ const protocol = workspace.getConfiguration('github').get<'https' | 'ssh'>('gitProtocol');
+ const remoteUrl = protocol === 'https' ? ghRepository.clone_url : ghRepository.ssh_url;
+ await repository.addRemote('origin', remoteUrl);
try {
await repository.fetch('origin', remoteName);
@@ -118,20 +120,20 @@ async function handlePushError(repository: Repository, remote: Remote, refspec:
}
}
- const res = await octokit.pulls.create({
+ const { data: pr } = await octokit.pulls.create({
owner,
repo,
title,
body,
head: `${ghRepository.owner.login}:${remoteName}`,
- base: remoteName
+ base: ghRepository.default_branch
});
await repository.setConfig(`branch.${localName}.remote`, 'upstream');
await repository.setConfig(`branch.${localName}.merge`, `refs/heads/${remoteName}`);
await repository.setConfig(`branch.${localName}.github-pr-owner-number`, `${owner}#${repo}#${pr.number}`);
- return res.data;
+ return pr;
});
const openPR = localize('openpr', "Open PR");