Skip to content
Permalink
Browse files

set exec's maxBuffer

It's kind of annoying that we have to do this, but I've hit this a few
times for reasons I don't really understand. So let's just make the
buffer huge and hope we don't fill it.
  • Loading branch information...
novalis committed Sep 23, 2019
1 parent 9610e6f commit 1964ea4ae70b73110a837aa4979f828ddaf752b3
Showing with 27 additions and 8 deletions.
  1. +24 −7 node/lib/util/git_util.js
  2. +3 −1 node/lib/util/merge_util.js
@@ -48,6 +48,8 @@ const Hook = require("./hook");
const GitUtilFast = require("./git_util_fast");
const UserError = require("./user_error");

const EXEC_BUFFER = 1024*1024*100;

/**
* Create a branch having the specified `branchName` in the specified `repo`
* pointing to the current head.
@@ -360,12 +362,18 @@ exports.push = co.wrap(function *(repo, remote, source, target, force, quiet) {
const execString = `\
git -C '${repo.path()}' push ${forceStr} ${remote} ${source}:${target}`;
try {
let result = yield ChildProcess.exec(execString, {env : environ});
let result = yield ChildProcess.exec(execString, {
env : environ,
maxBuffer: EXEC_BUFFER
});
if (result.error &&
result.stderr.indexOf("reference already exists") !== -1) {
// GitLab has a race condition that somehow causes this to
// happen spuriously -- let's retry.
result = yield ChildProcess.exec(execString, {env : environ});
result = yield ChildProcess.exec(execString, {
env : environ,
maxBuffer: EXEC_BUFFER
});
}
if (result.error || !quiet) {
if (result.stdout) {
@@ -481,7 +489,9 @@ exports.fetch = co.wrap(function *(repo, remoteName) {

const execString = `git -C '${repo.path()}' fetch -q '${remoteName}'`;
try {
return yield ChildProcess.exec(execString);
return yield ChildProcess.exec(execString, {
maxBuffer: EXEC_BUFFER
});
}
catch (e) {
throw new UserError(e.message);
@@ -510,7 +520,9 @@ exports.fetchBranch = co.wrap(function *(repo, remoteName, branch) {
const execString = `\
git -C '${repo.path()}' fetch -q '${remoteName}' '${branch}'`;
try {
return yield ChildProcess.exec(execString);
return yield ChildProcess.exec(execString, {
maxBuffer: EXEC_BUFFER
});
}
catch (e) {
throw new UserError(e.message);
@@ -544,7 +556,9 @@ exports.fetchSha = co.wrap(function *(repo, url, sha) {

const execString = `git -C '${repo.path()}' fetch -q '${url}' ${sha}`;
try {
yield ChildProcess.exec(execString);
yield ChildProcess.exec(execString, {
maxBuffer: EXEC_BUFFER
});
yield repo.getCommit(sha);
}
catch (e) {
@@ -712,7 +726,8 @@ exports.getEditorCommand = co.wrap(function *(repo) {
// `git`.

const result =
yield ChildProcess.exec(`git -C '${repo.path()}' var GIT_EDITOR`);
yield ChildProcess.exec(`git -C '${repo.path()}' var GIT_EDITOR`,
{maxBuffer: EXEC_BUFFER});
return result.stdout.split("\n")[0];
});

@@ -938,7 +953,9 @@ exports.mergeBases = co.wrap(function *(repo, commit1, commit2) {
const id2 = commit2.id().tostrS();
const execString = `\
git -C '${repo.path()}' merge-base ${id1} ${id2}`;
const result = yield ChildProcess.exec(execString);
const result = yield ChildProcess.exec(execString, {
maxBuffer: EXEC_BUFFER
});
if (result.error) {
throw new UserError("Couldn't run git merge-base: " +
result.stderr);
@@ -751,7 +751,9 @@ exports.continue = co.wrap(function *(repo) {
const resetMerge = co.wrap(function *(repo) {
// TODO: add this to libgit2
const execString = `git -C '${repo.workdir()}' reset --merge`;
yield ChildProcess.exec(execString);
yield ChildProcess.exec(execString, {
maxBuffer: 1024*1024*100
});
});

/**

0 comments on commit 1964ea4

Please sign in to comment.
You can’t perform that action at this time.