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);