提交 fd2e5ac7 编写于 作者: T Tom Basche

Add the ability to push empty commits

上级 a0764210
......@@ -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",
......
......@@ -1071,10 +1071,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;
......@@ -1119,6 +1122,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);
......
......@@ -386,6 +386,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.
先完成此消息的编辑!
想要评论请 注册