mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Add the ability to push empty commits
This commit is contained in:
parent
a0764210a8
commit
fd2e5ac7f8
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue