diff options
author | Kian | 2025-05-01 12:35:57 +0100 |
---|---|---|
committer | GitHub | 2025-05-01 13:35:57 +0200 |
commit | 80a7871ccad17aef8567a416a419669de6d5d3fd (patch) | |
tree | 031c73d70f56e4bbfc0f6a2993ecea311fd7370d | |
parent | b5232bcd201c2e3904bde2d7717fe6cfa06d6c82 (diff) | |
download | IT.starlight-80a7871ccad17aef8567a416a419669de6d5d3fd.tar.gz IT.starlight-80a7871ccad17aef8567a416a419669de6d5d3fd.tar.bz2 IT.starlight-80a7871ccad17aef8567a416a419669de6d5d3fd.zip |
Increase `maxBuffer` in `getAllNewestCommitDate`'s `spawnSync` usage (#3165)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
-rw-r--r-- | .changeset/slow-rivers-attack.md | 5 | ||||
-rw-r--r-- | packages/starlight/utils/git.ts | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/.changeset/slow-rivers-attack.md b/.changeset/slow-rivers-attack.md new file mode 100644 index 00000000..b7ea1326 --- /dev/null +++ b/.changeset/slow-rivers-attack.md @@ -0,0 +1,5 @@ +--- +"@astrojs/starlight": patch +--- + +Increases `maxBuffer` for an internal `spawnSync()` call to support larger Git commit histories when using Starlight's [`lastUpdated`](https://starlight.astro.build/reference/configuration/#lastupdated) feature. diff --git a/packages/starlight/utils/git.ts b/packages/starlight/utils/git.ts index 1536fac9..f05fd88e 100644 --- a/packages/starlight/utils/git.ts +++ b/packages/starlight/utils/git.ts @@ -72,6 +72,13 @@ export function getAllNewestCommitDate(rootPath: string, docsPath: string): [str { cwd: repoRoot, encoding: 'utf-8', + // The default `maxBuffer` for `spawnSync` is 1024 * 1024 bytes, a.k.a 1 MB. In big projects, + // the full git history can be larger than this, so we increase this to ~10 MB. For example, + // Cloudflare passed 1 MB with ~4,800 pages and ~17,000 commits. If we get reports of others + // hitting ENOBUFS errors here in the future, we may want to switch to streaming the git log + // with `spawn` instead. + // See https://github.com/withastro/starlight/issues/3154 + maxBuffer: 10 * 1024 * 1024, } ); |