Sfoglia il codice sorgente

Ensures that we use the proper opened repo

main
Eric Amodio 2 anni fa
parent
commit
aca5a81a35
1 ha cambiato i file con 16 aggiunte e 3 eliminazioni
  1. +16
    -3
      src/premium/github/githubGitProvider.ts

+ 16
- 3
src/premium/github/githubGitProvider.ts Vedi File

@ -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 {

Caricamento…
Annulla
Salva