When resolving a merge conflict allow accepting the default commit message

Fixes #6403
This commit is contained in:
Haritha Wickremasinghe
2019-01-14 13:22:03 -05:00
parent 2ab82c12ed
commit 23058bece6
3 changed files with 43 additions and 16 deletions

View File

@@ -1514,6 +1514,24 @@ export class Repository {
}
}
cleanupCommitEditMessage(message: string): string {
//TODO: Support core.commentChar
return message.replace(/^\s*#.*$\n?/gm, '').trim();
}
async getMergeMessage(): Promise<string | undefined> {
const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG');
try {
const raw = await readfile(mergeMsgPath, 'utf8');
return raw.trim();
}
catch {
return undefined;
}
}
async getCommitTemplate(): Promise<string> {
try {
const result = await this.run(['config', '--get', 'commit.template']);
@@ -1532,7 +1550,7 @@ export class Repository {
}
const raw = await readfile(templatePath, 'utf8');
return raw.replace(/^\s*#.*$\n?/gm, '').trim();
return raw.trim();
} catch (err) {
return '';