@@ -39,6 +39,7 @@ exports.createOrUpdateBranch = exports.tryFetch = exports.getWorkingBaseAndType
39
39
const core = __importStar(__nccwpck_require__(2186));
40
40
const uuid_1 = __nccwpck_require__(5840);
41
41
const CHERRYPICK_EMPTY = 'The previous cherry-pick is now empty, possibly due to conflict resolution.';
42
+ const NOTHING_TO_COMMIT = 'nothing to commit, working tree clean';
42
43
var WorkingBaseType;
43
44
(function (WorkingBaseType) {
44
45
WorkingBaseType["Branch"] = "branch";
@@ -138,7 +139,11 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
138
139
if (signoff) {
139
140
popts.push('--signoff');
140
141
}
141
- yield git.commit(popts);
142
+ const commitResult = yield git.commit(popts, true);
143
+ // 'nothing to commit' can occur when core.autocrlf is set to true
144
+ if (commitResult.exitCode != 0 && !commitResult.stdout.includes(NOTHING_TO_COMMIT)) {
145
+ throw new Error(`Unexpected error: ${commitResult.stderr}`);
146
+ }
142
147
}
143
148
// Remove uncommitted tracked and untracked changes
144
149
yield git.exec(['reset', '--hard']);
@@ -674,7 +679,7 @@ class GitCommandManager {
674
679
return yield this.exec(args, allowAllExitCodes);
675
680
});
676
681
}
677
- commit(options) {
682
+ commit(options, allowAllExitCodes = false ) {
678
683
return __awaiter(this, void 0, void 0, function* () {
679
684
const args = ['commit'];
680
685
if (this.identityGitOptions) {
@@ -683,7 +688,7 @@ class GitCommandManager {
683
688
if (options) {
684
689
args.push(...options);
685
690
}
686
- yield this.exec(args);
691
+ return yield this.exec(args, allowAllExitCodes );
687
692
});
688
693
}
689
694
config(configKey, configValue, globalConfig) {
0 commit comments