Skip to content

Commit 227518f

Browse files
committed
fix(build): harden cherry-pick script for large logs and merge commits
- Raise execSync maxBuffer for git log output - Use git log --no-merges so conventional merge titles are not cherry-picked Made-with: Cursor
1 parent fbd2f40 commit 227518f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

build/cherry-pick.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
const { execSync } = require('child_process');
44
const conventionalCommitsParser = require('conventional-commits-parser');
55
const chalk = require('chalk');
6+
7+
/** Node's default execSync buffer (~1 MiB) is too small for `git log` on long histories. */
8+
const GIT_LOG_EXEC_OPTS = { maxBuffer: 50 * 1024 * 1024 };
9+
610
const { version } = require('../package.json');
711

812
const releaseType = process.argv[2];
@@ -50,7 +54,8 @@ function getCommits(branch) {
5054
// all commits are too large for execSync buffer size so we'll just get since the last 3 years
5155
const date = new Date(new Date().setFullYear(new Date().getFullYear() - 3));
5256
const stdout = execSync(
53-
`git log ${branch || ''} --abbrev-commit --since=${date.getFullYear()}`
57+
`git log ${branch || ''} --no-merges --abbrev-commit --since=${date.getFullYear()}`,
58+
GIT_LOG_EXEC_OPTS
5459
).toString();
5560
const allCommits = stdout
5661
.split(/commit (?=[\w\d]{8}[\n\r])/)

0 commit comments

Comments
 (0)