diff --git a/src/git/gitService.ts b/src/git/gitService.ts index 4e726e2..f3c2602 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -1773,7 +1773,9 @@ export class GitService implements Disposable { const repositories = [...(await this.getRepositories())]; if (repositories.length === 0) return repositories; - return repositories.sort((a, b) => (a.starred ? -1 : 1) - (b.starred ? -1 : 1) || a.index - b.index); + return repositories + .filter(r => !r.closed) + .sort((a, b) => (a.starred ? -1 : 1) - (b.starred ? -1 : 1) || a.index - b.index); } private async getRepositoryTree(): Promise> { diff --git a/src/views/nodes/repositoriesNode.ts b/src/views/nodes/repositoriesNode.ts index 06448cc..706b88f 100644 --- a/src/views/nodes/repositoriesNode.ts +++ b/src/views/nodes/repositoriesNode.ts @@ -39,14 +39,7 @@ export class RepositoriesNode extends SubscribeableViewNode { const repositories = await Container.git.getOrderedRepositories(); if (repositories.length === 0) return [new MessageNode(this.view, this, 'No repositories could be found.')]; - const children = []; - for (const repo of repositories) { - if (repo.closed) continue; - - children.push(new RepositoryNode(GitUri.fromRepoPath(repo.path), this.view, this, repo)); - } - - this._children = children; + this._children = repositories.map(r => new RepositoryNode(GitUri.fromRepoPath(r.path), this.view, this, r)); } return this._children; @@ -84,8 +77,6 @@ export class RepositoriesNode extends SubscribeableViewNode { const children = []; for (const repo of repositories) { - if (repo.closed) continue; - const normalizedPath = repo.normalizedPath; const child = (this._children as RepositoryNode[]).find(c => c.repo.normalizedPath === normalizedPath); if (child !== undefined) {