From 024df3355377d566bcad4fa54b7fadbdeb6e39d3 Mon Sep 17 00:00:00 2001 From: dfireBird Date: Mon, 21 Sep 2020 23:33:44 +0530 Subject: [PATCH] feat: add setting for default stash message --- extensions/git/package.json | 6 ++++++ extensions/git/package.nls.json | 1 + extensions/git/src/commands.ts | 14 ++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/extensions/git/package.json b/extensions/git/package.json index 284dadb4352..72428c5063a 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -2012,6 +2012,12 @@ "default": true, "description": "%config.terminalAuthentication%" }, + "git.defaultStashMessage": { + "type": "boolean", + "scope": "resource", + "default": false, + "description": "%config.defaultStashMessage%" + }, "git.githubAuthentication": { "deprecationMessage": "This setting is now deprecated, please use `github.gitAuthentication` instead." }, diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 19d3c5baf1b..c013d399f9f 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -176,6 +176,7 @@ "config.timeline.date": "Controls which date to use for items in the Timeline view", "config.timeline.date.committed": "Use the committed date", "config.timeline.date.authored": "Use the authored date", + "config.defaultStashMessage": "Controls whether to use message from commit input box (if populated) as default stash messages", "submenu.commit": "Commit", "submenu.commit.amend": "Amend", "submenu.commit.signoff": "Sign Off", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index c0d251a1d98..42992ad9b06 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -2506,12 +2506,14 @@ export class CommandCenter { } } - let defaultStashMessage: string; - const commitTemplate = repository.sourceControl.commitTemplate; - if (commitTemplate === undefined) { - defaultStashMessage = repository.inputBox.value; - } else { - defaultStashMessage = repository.inputBox.value.replace(commitTemplate, ''); + let defaultStashMessage = ''; + if (config.get('defaultStashMessage')) { + const commitTemplate = repository.sourceControl.commitTemplate; + if (commitTemplate === undefined) { + defaultStashMessage = repository.inputBox.value; + } else { + defaultStashMessage = repository.inputBox.value.replace(commitTemplate, ''); + } } const message = await this.getStashMessage(defaultStashMessage);