From 131663140f8f80c13305f22ceb67e8d0e4ab5e79 Mon Sep 17 00:00:00 2001 From: Vladimir Vagaytsev <10628074+vvagaytsev@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:15:06 +0200 Subject: [PATCH] perf(git): use `sub-tree` scan mode for config files scan (#6483) --- core/src/garden.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/garden.ts b/core/src/garden.ts index 49cbd890bc..13b455b1ea 100644 --- a/core/src/garden.ts +++ b/core/src/garden.ts @@ -277,6 +277,7 @@ export class Garden { public readonly localConfigStore: LocalConfigStore public globalConfigStore: GlobalConfigStore public readonly vcs: VcsHandler + private readonly configScanVcs: VcsHandler public events: EventBus private tools?: { [key: string]: PluginTool } public readonly configTemplates: { [name: string]: ConfigTemplateConfig } @@ -373,12 +374,19 @@ export class Garden { const gitMode = params.projectConfig.scan?.git?.mode || gardenEnv.GARDEN_GIT_SCAN_MODE const handlerCls = gitMode === "repo" ? GitRepoHandler : GitSubTreeHandler + const vcsCache = new TreeCache() this.vcs = new handlerCls({ garden: this, projectRoot: params.projectRoot, gardenDirPath: params.gardenDirPath, ignoreFile: params.dotIgnoreFile, - cache: new TreeCache(), + cache: vcsCache, + }) + this.configScanVcs = new GitSubTreeHandler({ + projectRoot: params.projectRoot, + gardenDirPath: params.gardenDirPath, + ignoreFile: params.dotIgnoreFile, + cache: vcsCache, }) // Use the legacy build sync mode if @@ -1349,7 +1357,7 @@ export class Garden { log.silly(() => `Scanning for configs in ${path}`) return findConfigPathsInPath({ - vcs: this.vcs, + vcs: this.configScanVcs, dir: path, include: this.moduleIncludePatterns, exclude: this.moduleExcludePatterns,