Skip to content

Commit

Permalink
perf(git): use sub-tree scan mode for config files scan (#6483)
Browse files Browse the repository at this point in the history
  • Loading branch information
vvagaytsev authored Oct 18, 2024
1 parent 593c9cb commit 1316631
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/src/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1316631

Please sign in to comment.