Revert "A full editor can be used as git commit message editor (#95266)" (#150487)

This reverts commit 97f8e66d74.
This commit is contained in:
Ladislau Szomoru
2022-05-26 23:06:23 +02:00
committed by GitHub
parent 33a8212fd2
commit 9bfd3c1d72
17 changed files with 45 additions and 235 deletions

View File

@@ -1400,37 +1400,20 @@ export class Repository {
}
async commit(message: string | undefined, opts: CommitOptions = Object.create(null)): Promise<void> {
const args = ['commit', '--quiet'];
const options: SpawnOptions = {};
if (message) {
options.input = message;
args.push('--file', '-');
}
if (opts.verbose) {
args.push('--verbose');
}
const args = ['commit', '--quiet', '--allow-empty-message'];
if (opts.all) {
args.push('--all');
}
if (opts.amend) {
if (opts.amend && message) {
args.push('--amend');
}
if (!opts.useEditor) {
if (!message) {
if (opts.amend) {
args.push('--no-edit');
} else {
options.input = '';
args.push('--file', '-');
}
}
args.push('--allow-empty-message');
if (opts.amend && !message) {
args.push('--amend', '--no-edit');
} else {
args.push('--file', '-');
}
if (opts.signoff) {
@@ -1455,7 +1438,7 @@ export class Repository {
}
try {
await this.exec(args, options);
await this.exec(args, !opts.amend || message ? { input: message || '' } : {});
} catch (commitErr) {
await this.handleCommitError(commitErr);
}
@@ -1479,9 +1462,6 @@ export class Repository {
if (/not possible because you have unmerged files/.test(commitErr.stderr || '')) {
commitErr.gitErrorCode = GitErrorCodes.UnmergedChanges;
throw commitErr;
} else if (/Aborting commit due to empty commit message/.test(commitErr.stderr || '')) {
commitErr.gitErrorCode = GitErrorCodes.EmptyCommitMessage;
throw commitErr;
}
try {