not-an-aardvark/git-delete-squashed

EAGAIN error

Opened this issue · 1 comments

possibly related to #1

When I run this tool via node on a big repo, I'm getting EAGAIN error on git rev-parse or merge-base

Error is like below (branch name is different every time I run the command)

git-delete-squashed
events.js:377
      throw er; // Unhandled 'error' event
      ^

Error: spawn git EAGAIN
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  errno: -35,
  code: 'EAGAIN',
  syscall: 'spawn git',
  path: 'git',
  spawnargs: [ 'merge-base', 'master', 'mynicebranch' ]
}

seems like this code is issuing too many concurrent git process

  }).filter(branchName =>
    // Get the common ancestor with the branch and master
    Promise.join(
      git(['merge-base', selectedBranchName, branchName]),
      git(['rev-parse', `${branchName}^{tree}`]),
      (ancestorHash, treeId) => git(['commit-tree', treeId, '-p', ancestorHash, '-m', `Temp commit for ${branchName}`])
    )
      .then(danglingCommitId => git(['cherry', selectedBranchName, danglingCommitId]))
      .then(output => output.startsWith('-'))
  )