mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
fix(ci): raise the git ls-files buffer in check:tracked-artifacts (#8844)
* fix(ci): raise the git ls-files buffer in check:tracked-artifacts `execFileSync` defaults to a 1 MiB stdout buffer and throws ENOBUFS past it. `git ls-files -s` on this repo is already at 1,042,494 bytes across 11,091 tracked files — 6,082 bytes from the ceiling. Any PR adding roughly sixty files crosses it. That matters more than a failing script: the check runs on pre-commit, so once the listing crosses 1 MiB, committing breaks for everyone working the repo, not just for the change that happened to cross it. It is not a hypothetical — the private EE fork hit it this week when a sync landed ~214 translation files and pushed the listing 504 bytes over; every commit there failed the hook until this same fix landed. Both call sites now share a GIT_LS_OPTS with a 64 MiB ceiling — far above any plausible tree, rather than just above today's, since the listing only grows. * docs(changelog): add fragment for #8844 Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7193b0a433
commit
ed6a19e05b
@@ -51,8 +51,17 @@ export function checkTrackedArtifacts(trackedFiles, trackedSymlinks = []) {
|
||||
return violations;
|
||||
}
|
||||
|
||||
/**
|
||||
* `execFileSync` defaults to a 1 MiB stdout buffer and throws ENOBUFS past it.
|
||||
* This check runs on pre-commit, so crossing that line breaks committing for
|
||||
* the whole repo, not just the change that crossed it. `git ls-files -s` is
|
||||
* already at ~1.04 MB here and only grows, so the ceiling is set far above any
|
||||
* plausible tree instead of just above today's.
|
||||
*/
|
||||
const GIT_LS_OPTS = { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 };
|
||||
|
||||
function getTrackedFiles() {
|
||||
const output = execFileSync("git", ["ls-files"], { encoding: "utf8" });
|
||||
const output = execFileSync("git", ["ls-files"], GIT_LS_OPTS);
|
||||
return output
|
||||
.split("\n")
|
||||
.map((l) => l.trim())
|
||||
@@ -62,7 +71,7 @@ function getTrackedFiles() {
|
||||
function getTrackedSymlinks() {
|
||||
// git ls-files -s prints: <mode> <hash> <stage>\t<path>
|
||||
// mode 120000 = symlink
|
||||
const output = execFileSync("git", ["ls-files", "-s"], { encoding: "utf8" });
|
||||
const output = execFileSync("git", ["ls-files", "-s"], GIT_LS_OPTS);
|
||||
const symlinks = [];
|
||||
for (const line of output.split("\n")) {
|
||||
if (line.startsWith("120000")) {
|
||||
|
||||
Reference in New Issue
Block a user