From 9caffaaa2aa00d31675d7ab3f228d28f7eb0927d Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Wed, 4 Feb 2026 11:53:09 +0100 Subject: [PATCH] Git - do not show repositories in the empty window (#292804) --- extensions/git/src/repository.ts | 13 ++++++++----- extensions/git/src/statusbar.ts | 6 +++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 7ae8527b101..8175e9b576a 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -957,11 +957,14 @@ export class Repository implements Disposable { : new ThemeIcon('repo'); // Hidden - // This is a temporary solution to hide worktrees created by Copilot - // when the main repository is opened. Users can still manually open - // the worktree from the Repositories view. - this._isHidden = repository.kind === 'worktree' && - isCopilotWorktree(repository.root) && parent !== undefined; + // This is a temporary solution to hide: + // * repositories in the empty window + // * worktrees created by Copilot when the main repository + // is opened. Users can still manually open the worktree + // from the Repositories view. + this._isHidden = workspace.workspaceFolders === undefined || + (repository.kind === 'worktree' && + isCopilotWorktree(repository.root) && parent !== undefined); const root = Uri.file(repository.root); this._sourceControl = scm.createSourceControl('git', 'Git', root, icon, this._isHidden, parent); diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index 6a06209eb41..d5cbe86ee7c 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -292,13 +292,17 @@ export class StatusBarCommands { private checkoutStatusBar: CheckoutStatusBar; private disposables: Disposable[] = []; - constructor(repository: Repository, remoteSourcePublisherRegistry: IRemoteSourcePublisherRegistry) { + constructor(private readonly repository: Repository, remoteSourcePublisherRegistry: IRemoteSourcePublisherRegistry) { this.syncStatusBar = new SyncStatusBar(repository, remoteSourcePublisherRegistry); this.checkoutStatusBar = new CheckoutStatusBar(repository); this.onDidChange = anyEvent(this.syncStatusBar.onDidChange, this.checkoutStatusBar.onDidChange); } get commands(): Command[] { + if (this.repository.isHidden) { + return []; + } + return [this.checkoutStatusBar.command, this.syncStatusBar.command] .filter((c): c is Command => !!c); }