This commit is contained in:
Joao Moreno 2019-11-08 15:55:30 +01:00
parent 655bd8f303
commit fd091abb85
No known key found for this signature in database
GPG key ID: 9494F5E6167A8E6B
4 changed files with 17 additions and 3 deletions

View file

@ -1608,6 +1608,12 @@
"default": "mixed",
"description": "%config.untrackedChanges%",
"scope": "resource"
},
"git.restoreCommitTemplateComments": {
"type": "boolean",
"scope": "resource",
"default": true,
"description": "%config.restoreCommitTemplateComments%"
}
}
},

View file

@ -139,6 +139,7 @@
"config.untrackedChanges.mixed": "All changes, tracked and untracked, appear together and behave equally.",
"config.untrackedChanges.separate": "Untracked changes appear separately in the Source Control view. They are also excluded from several actions.",
"config.untrackedChanges.hidden": "Untracked changes are hidden and excluded from several actions.",
"config.restoreCommitTemplateComments": "Controls whether to restore commit template comments in the commit input box.",
"colors.added": "Color for added resources.",
"colors.modified": "Color for modified resources.",
"colors.deleted": "Color for deleted resources.",

View file

@ -1823,7 +1823,6 @@ export class Repository {
return message.replace(/^\s*#.*$\n?/gm, '').trim();
}
async getMergeMessage(): Promise<string | undefined> {
const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG');

View file

@ -844,7 +844,15 @@ export class Repository implements Disposable {
return mergeMessage;
}
return await this.repository.getCommitTemplate();
let template = await this.repository.getCommitTemplate();
const config = workspace.getConfiguration('git', Uri.file(this.root));
if (!config.get<boolean>('restoreCommitTemplateComments')) {
template = this.cleanUpCommitEditMessage(template);
}
return template;
}
getConfigs(): Promise<{ key: string; value: string; }[]> {
@ -1278,7 +1286,7 @@ export class Repository implements Disposable {
return await this.run(Operation.GetCommitTemplate, async () => this.repository.getCommitTemplate());
}
async cleanUpCommitEditMessage(editMessage: string): Promise<string> {
cleanUpCommitEditMessage(editMessage: string): string {
return this.repository.cleanupCommitEditMessage(editMessage);
}