@@ -46,6 +46,7 @@ exports.buildBranchCommits = buildBranchCommits;
46
46
exports.createOrUpdateBranch = createOrUpdateBranch;
47
47
const core = __importStar(__nccwpck_require__(2186));
48
48
const uuid_1 = __nccwpck_require__(5840);
49
+ const utils = __importStar(__nccwpck_require__(918));
49
50
const CHERRYPICK_EMPTY = 'The previous cherry-pick is now empty, possibly due to conflict resolution.';
50
51
const NOTHING_TO_COMMIT = 'nothing to commit, working tree clean';
51
52
const FETCH_DEPTH_MARGIN = 10;
@@ -136,9 +137,19 @@ function isEven(git, branch1, branch2) {
136
137
// Return true if the specified number of commits on branch1 and branch2 have a diff
137
138
function commitsHaveDiff(git, branch1, branch2, depth) {
138
139
return __awaiter(this, void 0, void 0, function* () {
139
- const diff1 = (yield git.exec(['diff', '--stat', `${branch1}..${branch1}~${depth}`])).stdout.trim();
140
- const diff2 = (yield git.exec(['diff', '--stat', `${branch2}..${branch2}~${depth}`])).stdout.trim();
141
- return diff1 !== diff2;
140
+ // Some action use cases lead to the depth being a very large number and the diff fails.
141
+ // I've made this check optional for now because it was a fix for an edge case that is
142
+ // very rare, anyway.
143
+ try {
144
+ const diff1 = (yield git.exec(['diff', '--stat', `${branch1}..${branch1}~${depth}`])).stdout.trim();
145
+ const diff2 = (yield git.exec(['diff', '--stat', `${branch2}..${branch2}~${depth}`])).stdout.trim();
146
+ return diff1 !== diff2;
147
+ }
148
+ catch (error) {
149
+ core.info('Failed optional check of commits diff; Skipping.');
150
+ core.debug(utils.getErrorMessage(error));
151
+ return false;
152
+ }
142
153
});
143
154
}
144
155
function splitLines(multilineString) {
0 commit comments