Adding .git/SQUASH_MSG detection to commit message autofill

This commit is contained in:
Daniel Davis
2020-06-26 12:35:32 +01:00
parent 277627c090
commit 3f90d90ab2
2 changed files with 14 additions and 0 deletions

View File

@@ -1939,6 +1939,17 @@ export class Repository {
return message.replace(/^\s*#.*$\n?/gm, '').trim();
}
async getSquashMessage(): Promise<string | undefined> {
const squashMsgPath = path.join(this.repositoryRoot, '.git', 'SQUASH_MSG');
try {
const raw = await fs.readFile(squashMsgPath, 'utf8');
return this.stripCommitMessageComments(raw);
} catch {
return undefined;
}
}
async getMergeMessage(): Promise<string | undefined> {
const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG');