提交 e2b2b5bc 编写于 作者: J Joao Moreno

Merge branch 'master', commit 'refs/pull/56048/head' of github.com:Microsoft/vscode into pr/56048

......@@ -190,6 +190,11 @@
"title": "%command.commitStaged%",
"category": "Git"
},
{
"command": "git.commitEmpty",
"title": "%command.commitEmpty%",
"category": "Git"
},
{
"command": "git.commitStagedSigned",
"title": "%command.commitStagedSigned%",
......@@ -417,6 +422,10 @@
"command": "git.commit",
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitEmpty",
"when": "config.git.allowcommitEmptys && gitOpenRepositoryCount != 0"
},
{
"command": "git.commitStaged",
"when": "config.git.enabled && gitOpenRepositoryCount != 0"
......@@ -599,6 +608,11 @@
"group": "3_commit",
"when": "scmProvider == git"
},
{
"command": "git.commitEmpty",
"group": "3_commit",
"when": "scmProvider == git"
},
{
"command": "git.commitStagedSigned",
"group": "3_commit",
......@@ -991,6 +1005,12 @@
"description": "%config.enableCommitSigning%",
"default": false
},
"git.allowEmptyCommits": {
"type": "boolean",
"scope": "resource",
"description": "%config.allowEmptyCommits%",
"default": false
},
"git.decorations.enabled": {
"type": "boolean",
"default": true,
......
......@@ -22,6 +22,7 @@
"command.cleanAll": "Discard All Changes",
"command.commit": "Commit",
"command.commitStaged": "Commit Staged",
"command.commitEmpty": "Commit Empty",
"command.commitStagedSigned": "Commit Staged (Signed Off)",
"command.commitStagedAmend": "Commit Staged (Amend)",
"command.commitAll": "Commit All",
......
......@@ -1086,10 +1086,13 @@ export class CommandCenter {
}
if (
(
// no changes
(noStagedChanges && noUnstagedChanges)
// or no staged changes and not `all`
|| (!opts.all && noStagedChanges)
)
&& !opts.empty
) {
window.showInformationMessage(localize('no changes', "There are no changes to commit."));
return false;
......@@ -1134,6 +1137,11 @@ export class CommandCenter {
}
}
@command('git.commitEmpty', { repository: true})
async commit(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository, { empty: true });
}
@command('git.commit', { repository: true })
async commit(repository: Repository): Promise<void> {
await this.commitWithAnyInput(repository);
......
......@@ -958,6 +958,9 @@ export class Repository {
if (opts.signCommit) {
args.push('-S');
}
if (opts.empty) {
args.push('--allow-empty');
}
try {
await this.run(args, { input: message || '' });
......
......@@ -395,6 +395,7 @@ export interface CommitOptions {
amend?: boolean;
signoff?: boolean;
signCommit?: boolean;
empty?: boolean;
}
export interface GitResourceGroup extends SourceControlResourceGroup {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册