Files
reverse-engineering-anything/patches/release-please+17.3.0.patch
T

72 lines
3.5 KiB
Diff

--- a/build/src/manifest.js
+++ b/build/src/manifest.js
@@ -261,9 +261,19 @@
this.logger.info('Collecting commits since all latest releases');
const commits = [];
this.logger.debug(`commit search depth: ${this.commitSearchDepth}`);
+ // The root receives every commit without path splitting. Node's strategy,
+ // default changelog and extra-file updaters do not inspect commit.files.
+ // Keep the general path for exclusions, plugins and other strategies.
+ const rootConfig = this.repositoryConfig[exports.ROOT_PROJECT_PATH];
+ const rootOnlyNode = Object.keys(this.repositoryConfig).length === 1 &&
+ rootConfig?.releaseType === 'node' &&
+ (!rootConfig.changelogType || rootConfig.changelogType === 'default') &&
+ (!rootConfig.versioning || ['default', 'always-bump-minor'].includes(rootConfig.versioning)) &&
+ !rootConfig.excludePaths?.length &&
+ this.plugins.length === 0;
const commitGenerator = this.github.mergeCommitIterator(this.targetBranch, {
maxResults: this.commitSearchDepth,
- backfillFiles: true,
+ backfillFiles: !rootOnlyNode,
batchSize: this.commitBatchSize,
});
const releaseShas = new Set(Object.values(releaseShasByPath));
@@ -272,6 +282,7 @@
// sha => release pull request
const releasePullRequestsBySha = {};
let releaseCommitsFound = 0;
+ let historyBoundaryFound = false;
for await (const commit of commitGenerator) {
if (releaseShas.has(commit.sha)) {
if (commit.pullRequest) {
@@ -284,14 +295,17 @@
}
if (this.lastReleaseSha && this.lastReleaseSha === commit.sha) {
this.logger.info(`Using configured lastReleaseSha ${this.lastReleaseSha} as last commit.`);
+ historyBoundaryFound = true;
break;
}
else if (needsBootstrap && commit.sha === this.bootstrapSha) {
this.logger.info(`Needed bootstrapping, found configured bootstrapSha ${this.bootstrapSha}`);
+ historyBoundaryFound = true;
break;
}
else if (!needsBootstrap && releaseCommitsFound >= expectedShas) {
// found enough commits
+ historyBoundaryFound = true;
break;
}
commits.push({
@@ -301,16 +315,18 @@
pullRequest: commit.pullRequest,
});
}
+ if (releaseCommitsFound < expectedShas && !historyBoundaryFound) {
+ throw new Error(`Incomplete release history: expected ${expectedShas} release boundaries, found ${releaseCommitsFound}. Refusing a partial release proposal.`);
+ }
if (releaseCommitsFound < expectedShas) {
this.logger.warn(`Expected ${expectedShas} commits, only found ${releaseCommitsFound}`);
}
// split commits by path
this.logger.info(`Splitting ${commits.length} commits by path`);
- const cs = new commit_split_1.CommitSplit({
+ const splitCommits = rootOnlyNode ? {} : new commit_split_1.CommitSplit({
includeEmpty: true,
packagePaths: Object.keys(this.repositoryConfig),
- });
- const splitCommits = cs.split(commits);
+ }).split(commits);
// limit paths to ones since the last release
let commitsPerPath = {};
for (const path in this.repositoryConfig) {