Procházet zdrojové kódy

Ensures that we use the proper opened repo

main
Eric Amodio před 2 roky
rodič
revize
aca5a81a35
1 změnil soubory, kde provedl 16 přidání a 3 odebrání
  1. +16
    -3
      src/premium/github/githubGitProvider.ts

+ 16
- 3
src/premium/github/githubGitProvider.ts Zobrazit soubor

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

Načítá se…
Zrušit
Uložit