From 80a7871ccad17aef8567a416a419669de6d5d3fd Mon Sep 17 00:00:00 2001 From: Kian Date: Thu, 1 May 2025 12:35:57 +0100 Subject: Increase `maxBuffer` in `getAllNewestCommitDate`'s `spawnSync` usage (#3165) Co-authored-by: Chris Swithinbank --- .changeset/slow-rivers-attack.md | 5 +++++ packages/starlight/utils/git.ts | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/slow-rivers-attack.md 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, } ); -- cgit