Selaa lähdekoodia

Ensures that we use the proper opened repo

main
Eric Amodio 2 vuotta sitten
vanhempi
commit
aca5a81a35
1 muutettua tiedostoa jossa 16 lisäystä ja 3 poistoa
  1. +16
    -3
      src/premium/github/githubGitProvider.ts

+ 16
- 3
src/premium/github/githubGitProvider.ts Näytä tiedosto

@ -143,8 +143,11 @@ export class GitHubGitProvider implements GitProvider, Disposable {
if (!this.supportedSchemes.has(uri.scheme)) return [];
try {
void (await this.ensureRepositoryContext(uri.toString()));
return [this.openRepository(undefined, uri, true)];
const { remotehub } = await this.ensureRepositoryContext(uri.toString(), true);
const workspaceUri = remotehub.getVirtualWorkspaceUri(uri);
if (workspaceUri == null) return [];
return [this.openRepository(undefined, workspaceUri, true)];
} catch {
return [];
}
@ -2118,12 +2121,22 @@ export class GitHubGitProvider implements GitProvider, Disposable {
@gate()
private async ensureRepositoryContext(
repoPath: string,
open?: boolean,
): Promise<{ github: GitHubApi; metadata: Metadata; remotehub: RemoteHubApi; session: AuthenticationSession }> {
const uri = Uri.parse(repoPath, true);
let uri = Uri.parse(repoPath, true);
if (!/^github\+?/.test(uri.authority)) {
throw new OpenVirtualRepositoryError(repoPath, OpenVirtualRepositoryErrorReason.NotAGitHubRepository);
}
if (!open) {
const repo = this.container.git.getRepository(uri);
if (repo == null) {
throw new OpenVirtualRepositoryError(repoPath, OpenVirtualRepositoryErrorReason.NotAGitHubRepository);
}
uri = repo.uri;
}
let remotehub = this._remotehub;
if (remotehub == null) {
try {

Ladataan…
Peruuta
Tallenna