Git - do not show repositories in the empty window (#292804)

This commit is contained in:
Ladislau Szomoru
2026-02-04 11:53:09 +01:00
committed by GitHub
parent 82b251a409
commit 9caffaaa2a
2 changed files with 13 additions and 6 deletions

View File

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

View File

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