Skip to content

Commit d10e7bc

Browse files
authored
Git - do not prompt for opening worktrees (microsoft#256059)
1 parent 5dfe709 commit d10e7bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extensions/git/src/model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ export class Model implements IRepositoryResolver, IBranchProtectionProviderRegi
439439
@debounce(500)
440440
private eventuallyScanPossibleGitRepositories(): void {
441441
for (const path of this.possibleGitRepositoryPaths) {
442-
this.openRepository(path);
442+
this.openRepository(path, false, true);
443443
}
444444

445445
this.possibleGitRepositoryPaths.clear();
@@ -548,7 +548,7 @@ export class Model implements IRepositoryResolver, IBranchProtectionProviderRegi
548548
}
549549

550550
@sequentialize
551-
async openRepository(repoPath: string, openIfClosed = false): Promise<void> {
551+
async openRepository(repoPath: string, openIfClosed = false, openIfParent = false): Promise<void> {
552552
this.logger.trace(`[Model][openRepository] Repository: ${repoPath}`);
553553
const existingRepository = await this.getRepositoryExact(repoPath);
554554
if (existingRepository) {
@@ -597,7 +597,7 @@ export class Model implements IRepositoryResolver, IBranchProtectionProviderRegi
597597
const parentRepositoryConfig = config.get<'always' | 'never' | 'prompt'>('openRepositoryInParentFolders', 'prompt');
598598
if (parentRepositoryConfig !== 'always' && this.globalState.get<boolean>(`parentRepository:${repositoryRoot}`) !== true) {
599599
const isRepositoryOutsideWorkspace = await this.isRepositoryOutsideWorkspace(repositoryRoot);
600-
if (isRepositoryOutsideWorkspace) {
600+
if (!openIfParent && isRepositoryOutsideWorkspace) {
601601
this.logger.trace(`[Model][openRepository] Repository in parent folder: ${repositoryRoot}`);
602602

603603
if (!this._parentRepositoriesManager.hasRepository(repositoryRoot)) {

0 commit comments

Comments
 (0)