Git - discover nested git repositories (#159291)

This commit is contained in:
Ladislau Szomoru
2022-09-07 15:35:46 +02:00
committed by GitHub
parent 401189ef31
commit eff6fa7696

View File

@@ -323,7 +323,7 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
@sequentialize
async openRepository(repoPath: string): Promise<void> {
this.outputChannelLogger.logTrace(`Opening repository: ${repoPath}`);
if (this.getRepository(repoPath)) {
if (this.getRepositoryExact(repoPath)) {
this.outputChannelLogger.logTrace(`Repository for path ${repoPath} already exists`);
return;
}
@@ -359,7 +359,7 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
const repositoryRoot = Uri.file(rawRoot).fsPath;
this.outputChannelLogger.logTrace(`Repository root: ${repositoryRoot}`);
if (this.getRepository(repositoryRoot)) {
if (this.getRepositoryExact(repositoryRoot)) {
this.outputChannelLogger.logTrace(`Repository for path ${repositoryRoot} already exists`);
return;
}
@@ -510,6 +510,12 @@ export class Model implements IRemoteSourcePublisherRegistry, IPostCommitCommand
return liveRepository && liveRepository.repository;
}
private getRepositoryExact(repoPath: string): Repository | undefined {
const openRepository = this.openRepositories
.find(r => pathEquals(r.repository.root, repoPath));
return openRepository?.repository;
}
private getOpenRepository(repository: Repository): OpenRepository | undefined;
private getOpenRepository(sourceControl: SourceControl): OpenRepository | undefined;
private getOpenRepository(resourceGroup: SourceControlResourceGroup): OpenRepository | undefined;