Fix #122277 - Trusted domains getRemotes call errors in virtual folder

This commit is contained in:
Jackson Kearl 2021-05-04 15:56:50 -07:00
parent 6902f8bfaf
commit ebe08a2e52
No known key found for this signature in database
GPG key ID: DA09A59C409FC400

View file

@ -156,14 +156,18 @@ async function getRemotes(fileService: IFileService, textFileService: ITextFileS
const domains = await Promise.race([
new Promise<string[][]>(resolve => setTimeout(() => resolve([]), 2000)),
Promise.all<string[]>(workspaceUris.map(async workspaceUri => {
const path = workspaceUri.path;
const uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/.git/config` });
const exists = await fileService.exists(uri);
if (!exists) {
try {
const path = workspaceUri.path;
const uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/.git/config` });
const exists = await fileService.exists(uri);
if (!exists) {
return [];
}
const gitConfig = (await (textFileService.read(uri, { acceptTextOnly: true }).catch(() => ({ value: '' })))).value;
return extractGitHubRemotesFromGitConfig(gitConfig);
} catch {
return [];
}
const gitConfig = (await (textFileService.read(uri, { acceptTextOnly: true }).catch(() => ({ value: '' })))).value;
return extractGitHubRemotesFromGitConfig(gitConfig);
}))]);
const set = domains.reduce((set, list) => list.reduce((set, item) => set.add(item), set), new Set<string>());