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); }