Skip to content

Commit 8baa7ed

Browse files
authored
Git - fix repository detection regression (microsoft#187578)
1 parent cac438f commit 8baa7ed

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

extensions/git/src/model.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,11 +767,14 @@ export class Model implements IBranchProtectionProviderRegistry, IRemoteSourcePu
767767

768768
private async getRepositoryExact(repoPath: string): Promise<Repository | undefined> {
769769
const repoPathCanonical = await fs.promises.realpath(repoPath, { encoding: 'utf8' });
770-
const openRepository = this.openRepositories.find(async r => {
771-
const rootPathCanonical = await fs.promises.realpath(r.repository.root, { encoding: 'utf8' });
772-
return pathEquals(rootPathCanonical, repoPathCanonical);
773-
});
774-
return openRepository?.repository;
770+
771+
for (const openRepository of this.openRepositories) {
772+
const rootPathCanonical = await fs.promises.realpath(openRepository.repository.root, { encoding: 'utf8' });
773+
if (pathEquals(rootPathCanonical, repoPathCanonical)) {
774+
return openRepository.repository;
775+
}
776+
}
777+
return undefined;
775778
}
776779

777780
private getOpenRepository(repository: Repository): OpenRepository | undefined;

0 commit comments

Comments
 (0)