Skip to content

Commit 927b1e5

Browse files
authored
Set maxBuffer on runLog to avoid ENOBUFS on large commit ranges (#103)
1 parent a24fb75 commit 927b1e5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/git.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,11 +382,16 @@ export function ensureCommitAvailable(sha: string, cwd: string = process.cwd()):
382382
);
383383
}
384384

385+
// A wide commit range outgrows Node's 1 MB default; keep a finite ceiling
386+
// rather than Infinity to bound memory.
387+
const RUN_LOG_MAX_BUFFER = 256 * 1024 * 1024;
388+
385389
function runLog(rangeArgs: string, cwd: string): CommitContext[] {
386390
const output = execSync(`git log --format=%H%x1f%B%x1f%D%x1e ${rangeArgs}`, {
387391
cwd,
388392
stdio: ["ignore", "pipe", "pipe"],
389393
encoding: "utf8",
394+
maxBuffer: RUN_LOG_MAX_BUFFER,
390395
});
391396
return output
392397
.split("\x1e")

0 commit comments

Comments
 (0)