Skip to content

Commit 16694c3

Browse files
committed
git: add commit toolbar menu item
1 parent cc8351e commit 16694c3

4 files changed

Lines changed: 28 additions & 5 deletions

File tree

extensions/git/package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@
9797
{
9898
"command": "git.commit",
9999
"title": "%command.commit%",
100-
"category": "Git"
100+
"category": "Git",
101+
"icon": {
102+
"light": "resources/icons/light/check.svg",
103+
"dark": "resources/icons/dark/check.svg"
104+
}
101105
},
102106
{
103107
"command": "git.commitStaged",
@@ -180,6 +184,11 @@
180184
],
181185
"menus": {
182186
"scm/title": [
187+
{
188+
"command": "git.commit",
189+
"group": "navigation",
190+
"when": "scmProvider == git"
191+
},
183192
{
184193
"command": "git.refresh",
185194
"group": "navigation",
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

extensions/git/src/commands.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,22 @@ export class CommandCenter {
331331
@CommandCenter.Command('git.commit')
332332
@CommandCenter.CatchErrors
333333
async commit(): Promise<void> {
334-
await this._commit(async () => await window.showInputBox({
335-
placeHolder: localize('commit message', "Commit message"),
336-
prompt: localize('provide commit message', "Please provide a commit message")
337-
}));
334+
const message = this.commitController.message;
335+
336+
const didCommit = await this._commit(async () => {
337+
if (message) {
338+
return message;
339+
}
340+
341+
return await window.showInputBox({
342+
placeHolder: localize('commit message', "Commit message"),
343+
prompt: localize('provide commit message', "Please provide a commit message")
344+
});
345+
});
346+
347+
if (message && didCommit) {
348+
this.commitController.message = '';
349+
}
338350
}
339351

340352
@CommandCenter.Command('git.commitWithInput')

0 commit comments

Comments
 (0)