Git - repository picker should not contain hidden source control providers (#285893)

This commit is contained in:
Ladislau Szomoru
2026-01-05 10:07:31 +00:00
committed by GitHub
parent 4fea0d7662
commit 5533614b42
2 changed files with 7 additions and 3 deletions

View File

@@ -877,7 +877,8 @@ export class Model implements IRepositoryResolver, IBranchProtectionProviderRegi
}
const repositories = this.openRepositories
.filter(r => !repositoryFilter || repositoryFilter.includes(r.repository.kind));
.filter(r => !r.repository.isHidden &&
(!repositoryFilter || repositoryFilter.includes(r.repository.kind)));
if (repositories.length === 0) {
throw new Error(l10n.t('There are no available repositories matching the filter'));

View File

@@ -879,6 +879,9 @@ export class Repository implements Disposable {
private _historyProvider: GitHistoryProvider;
get historyProvider(): GitHistoryProvider { return this._historyProvider; }
private _isHidden: boolean;
get isHidden(): boolean { return this._isHidden; }
private isRepositoryHuge: false | { limit: number } = false;
private didWarnAboutLimit = false;
@@ -956,11 +959,11 @@ export class Repository implements Disposable {
// 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.
const hidden = repository.kind === 'worktree' &&
this._isHidden = repository.kind === 'worktree' &&
isCopilotWorktree(repository.root) && parent !== undefined;
const root = Uri.file(repository.root);
this._sourceControl = scm.createSourceControl('git', 'Git', root, icon, hidden, parent);
this._sourceControl = scm.createSourceControl('git', 'Git', root, icon, this._isHidden, parent);
this._sourceControl.contextValue = repository.kind;
this._sourceControl.quickDiffProvider = this;