Skip to content

Commit d6de7ad

Browse files
author
JadenSimon
committed
fix(tests): bump maxBuffer to 100MB
ref: 24b0df2
1 parent 3a51b69 commit d6de7ad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/shared/extensions/git.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { pushIf } from '../utilities/collectionUtils'
1616
interface GitFile {
1717
name: string
1818
/**
19-
* Reads the file's contents
19+
* Reads the file's contents. Affected by {@link maxBufferSizeInMB}.
2020
* @throws If the Git API becomes disabled or we were unable to read the file
2121
*/
2222
read: () => Promise<string>
@@ -50,6 +50,11 @@ interface GitConfig {
5050
const execFileAsync = promisify(execFile)
5151
const minGitFilterVersion = new SemVer('2.27.0')
5252

53+
// Arbitrary limit for the in-mem buffer when downloading files via `git cat-file`
54+
// This can be increased though for larger files streaming might be a better choice
55+
// See https://github.com/nodejs/node/issues/9829 for a discussion on `maxBuffer`
56+
const maxBufferSizeInMB = 100
57+
5358
function formatBranch(branch?: GitTypes.Branch): string {
5459
return branch?.name ?? branch?.commit ?? 'unknown'
5560
}
@@ -369,7 +374,7 @@ export class GitExtension {
369374

370375
return execFileAsync(api.git.path, ['cat-file', type, hash], {
371376
cwd: tmpDir,
372-
maxBuffer: 1024 * 1024 * 6,
377+
maxBuffer: 1024 * 1024 * maxBufferSizeInMB,
373378
}).then(({ stdout }) => stdout)
374379
},
375380
}))

0 commit comments

Comments
 (0)