Skip to content

Commit dff7c5a

Browse files
Copilotalexr00
andauthored
Skip cached inaccessible repositories during updates
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 2b06146 commit dff7c5a

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/github/folderRepositoryManager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,10 @@ export class FolderRepositoryManager extends Disposable {
510510
const oldRepositories: GitHubRepository[] = [];
511511
this._githubRepositories.forEach(repo => oldRepositories.push(repo));
512512

513-
const authenticatedRemotes = activeRemotes.filter(remote => this._credentialStore.isAuthenticated(remote.authProviderId));
513+
const authenticatedRemotes = activeRemotes.filter(remote =>
514+
this._credentialStore.isAuthenticated(remote.authProviderId)
515+
&& !this._inaccessibleRepos.has(`${remote.owner.toLowerCase()}/${remote.repositoryName.toLowerCase()}`)
516+
);
514517
for (const remote of authenticatedRemotes) {
515518
const repository = await this.createGitHubRepository(remote, this._credentialStore);
516519
resolveRemotePromises.push(repository.resolveRemote());

src/test/github/folderRepositoryManager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('PullRequestManager', function () {
6565
const healthyMetadata = sinon.stub(healthyRepository as any, 'getMetadataForRepo').resolves({ clone_url: healthyUrl } as never);
6666
sinon.stub(manager.credentialStore, 'isAuthenticated').returns(true);
6767
sinon.stub(manager.credentialStore, 'isAnyAuthenticated').returns(true);
68-
sinon.stub(manager, 'computeAllGitHubRemotes').resolves([inaccessibleRemote, healthyRemote]);
68+
sinon.stub(manager as any, 'getActiveRemotes').resolves([inaccessibleRemote, healthyRemote] as never);
6969
sinon.stub(manager as any, 'createAndAddGitHubRepository').callsFake(async (remote: Remote) => remote.remoteName === 'origin' ? inaccessibleRepository : healthyRepository);
7070
sinon.stub(manager as any, 'checkIfMissingUpstream').resolves(false as never);
7171
sinon.stub(manager as any, 'associateLocalBranchesWithPRsOnFirstActivation').resolves();

0 commit comments

Comments
 (0)