Skip to content

Commit fd091ab

Browse files
committed
1 parent 655bd8f commit fd091ab

4 files changed

Lines changed: 17 additions & 3 deletions

File tree

extensions/git/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,12 @@
16081608
"default": "mixed",
16091609
"description": "%config.untrackedChanges%",
16101610
"scope": "resource"
1611+
},
1612+
"git.restoreCommitTemplateComments": {
1613+
"type": "boolean",
1614+
"scope": "resource",
1615+
"default": true,
1616+
"description": "%config.restoreCommitTemplateComments%"
16111617
}
16121618
}
16131619
},

extensions/git/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
"config.untrackedChanges.mixed": "All changes, tracked and untracked, appear together and behave equally.",
140140
"config.untrackedChanges.separate": "Untracked changes appear separately in the Source Control view. They are also excluded from several actions.",
141141
"config.untrackedChanges.hidden": "Untracked changes are hidden and excluded from several actions.",
142+
"config.restoreCommitTemplateComments": "Controls whether to restore commit template comments in the commit input box.",
142143
"colors.added": "Color for added resources.",
143144
"colors.modified": "Color for modified resources.",
144145
"colors.deleted": "Color for deleted resources.",

extensions/git/src/git.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,6 @@ export class Repository {
18231823
return message.replace(/^\s*#.*$\n?/gm, '').trim();
18241824
}
18251825

1826-
18271826
async getMergeMessage(): Promise<string | undefined> {
18281827
const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG');
18291828

extensions/git/src/repository.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,15 @@ export class Repository implements Disposable {
844844
return mergeMessage;
845845
}
846846

847-
return await this.repository.getCommitTemplate();
847+
let template = await this.repository.getCommitTemplate();
848+
849+
const config = workspace.getConfiguration('git', Uri.file(this.root));
850+
851+
if (!config.get<boolean>('restoreCommitTemplateComments')) {
852+
template = this.cleanUpCommitEditMessage(template);
853+
}
854+
855+
return template;
848856
}
849857

850858
getConfigs(): Promise<{ key: string; value: string; }[]> {
@@ -1278,7 +1286,7 @@ export class Repository implements Disposable {
12781286
return await this.run(Operation.GetCommitTemplate, async () => this.repository.getCommitTemplate());
12791287
}
12801288

1281-
async cleanUpCommitEditMessage(editMessage: string): Promise<string> {
1289+
cleanUpCommitEditMessage(editMessage: string): string {
12821290
return this.repository.cleanupCommitEditMessage(editMessage);
12831291
}
12841292

0 commit comments

Comments
 (0)