Skip to content

Commit

Permalink
feat: change default git scan mode to repo (#5399)
Browse files Browse the repository at this point in the history
* feat: change default git scan mode to `repo`

The `repo` scan mode loads the entire repo files into a tree structure and applies glob matching from there.
This prevents a large amount of `git` subprocesses being spawned, and is much faster for large projects.
Especially on Windows it has a large performance benefit due to Windows being slow at spawning subprocesses.
We change this to be the default now, but it can always be overridden using the `GARDEN_GIT_SCAN_MODE=subtree` environment variable.

* chore: less noisy logging

* test: fix garden directory for version calculation tests
  • Loading branch information
TimBeyer committed Nov 14, 2023
1 parent 0512b63 commit da3f68f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const gardenEnv = {
GARDEN_ENVIRONMENT: env.get("GARDEN_ENVIRONMENT").required(false).asString(),
GARDEN_EXPERIMENTAL_BUILD_STAGE: env.get("GARDEN_EXPERIMENTAL_BUILD_STAGE").required(false).asBool(),
GARDEN_GE_SCHEDULED: env.get("GARDEN_GE_SCHEDULED").required(false).asBool(),
GARDEN_GIT_SCAN_MODE: env.get("GARDEN_GIT_SCAN_MODE").required(false).asEnum(gitScanModes),
GARDEN_GIT_SCAN_MODE: env.get("GARDEN_GIT_SCAN_MODE").required(false).default("repo").asEnum(gitScanModes),
GARDEN_LEGACY_BUILD_STAGE: env.get("GARDEN_LEGACY_BUILD_STAGE").required(false).asBool(),
GARDEN_LOG_LEVEL: env.get("GARDEN_LOG_LEVEL").required(false).asString(),
GARDEN_LOGGER_TYPE: env.get("GARDEN_LOGGER_TYPE").required(false).asString(),
Expand Down
4 changes: 2 additions & 2 deletions core/src/vcs/git-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ export class GitRepoHandler extends GitHandler {
existing = this.cache.get(log, key)

if (existing) {
params.log.silly(`Found cached repository match at ${path}`)
log.silly(`Found cached repository match at ${path}`)
return existing
}

params.log.info(`Scanning repository at ${path}`)
log.silly(`Scanning repository at ${path}`)
const files = await super.getFiles({ ...params, scanRoot: undefined })

const fileTree = FileTree.fromFiles(files)
Expand Down
2 changes: 1 addition & 1 deletion core/test/unit/src/plugins/container/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe("plugins.container", () => {
config: moduleConfig,
buildDependencies: [],
forceVersion: true,
scanRoot: garden.projectRoot,
scanRoot: projectRoot,
})
}

Expand Down

0 comments on commit da3f68f

Please sign in to comment.