Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/git/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export interface GitHubRepoContext {
export interface GitHubContext {
repos: GitHubRepoContext[];
reposByUri: Map<string, GitHubRepoContext>;
reposByOwnerAndName: Map<string, GitHubRepoContext>;
username: string;
}

Expand Down Expand Up @@ -199,6 +200,7 @@ export async function getGitHubContext(): Promise<GitHubContext | undefined> {
gitHubContext = Promise.resolve({
repos,
reposByUri: new Map(repos.map(r => [r.workspaceUri.toString(), r])),
reposByOwnerAndName: new Map(repos.map(r => [`${r.owner}/${r.name}`.toLocaleLowerCase(), r])),
username
});
} catch (e) {
Expand All @@ -224,7 +226,8 @@ export async function getGitHubContextForRepo(owner: string, name: string): Prom
return undefined;
}

return gitHubContext.repos.find(r => r.owner === owner && r.name === name);
const searchKey = `${owner}/${name}`.toLocaleLowerCase();
return gitHubContext.reposByOwnerAndName.get(searchKey);
}

export async function getGitHubContextForWorkspaceUri(
Expand Down