mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
Allow Continue On between repos with HTTPS and SSH remotes (#182352)
* Deduplicate HTTPS and SSH remote URLs * Improve doc
This commit is contained in:
@@ -24,7 +24,7 @@ export class GitEditSessionIdentityProvider implements vscode.EditSessionIdentit
|
||||
this.providerRegistration.dispose();
|
||||
}
|
||||
|
||||
async provideEditSessionIdentity(workspaceFolder: vscode.WorkspaceFolder, _token: vscode.CancellationToken): Promise<string | undefined> {
|
||||
async provideEditSessionIdentity(workspaceFolder: vscode.WorkspaceFolder, token: vscode.CancellationToken): Promise<string | undefined> {
|
||||
await this.model.openRepository(path.dirname(workspaceFolder.uri.fsPath));
|
||||
|
||||
const repository = this.model.getRepository(workspaceFolder.uri);
|
||||
@@ -34,8 +34,11 @@ export class GitEditSessionIdentityProvider implements vscode.EditSessionIdentit
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const remoteUrl = repository.remotes.find((remote) => remote.name === repository.HEAD?.upstream?.remote)?.pushUrl?.replace(/^(git@[^\/:]+)(:)/i, 'ssh://$1/');
|
||||
const remote = remoteUrl ? await vscode.workspace.provideCanonicalUriIdentity(vscode.Uri.parse(remoteUrl), token) : null;
|
||||
|
||||
return JSON.stringify({
|
||||
remote: repository.remotes.find((remote) => remote.name === repository.HEAD?.upstream?.remote)?.pushUrl ?? null,
|
||||
remote: remote?.toString() ?? remoteUrl,
|
||||
ref: repository.HEAD?.upstream?.name ?? null,
|
||||
sha: repository.HEAD?.commit ?? null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user