mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -05:00
Adds proper support for multiline commit messages
Fixes #33 - commit messages needs to be escaped
This commit is contained in:
@@ -65,12 +65,12 @@ export default class BlameAnnotationFormatter {
|
||||
}
|
||||
|
||||
static getAnnotationHover(config: IBlameConfig, line: IGitCommitLine, commit: GitCommit): string | Array<string> {
|
||||
const message = commit.message.replace(/\n/g, '\n\n');
|
||||
const message = `> \`${commit.message.replace(/\n/g, '\`\n>\n> \`')}\``;
|
||||
if (commit.isUncommitted) {
|
||||
return `\`${'0'.repeat(8)}\` __Uncommitted changes__`;
|
||||
}
|
||||
|
||||
return `\`${commit.sha}\` __${commit.author}__, ${moment(commit.date).fromNow()} _(${moment(commit.date).format('MMMM Do, YYYY h:MMa')})_ \n\n > ${message}`;
|
||||
return `\`${commit.sha}\` __${commit.author}__, ${moment(commit.date).fromNow()} _(${moment(commit.date).format('MMMM Do, YYYY h:MMa')})_ \n\n${message}`;
|
||||
}
|
||||
|
||||
static getAuthorAndDate(config: IBlameConfig, commit: GitCommit, format?: string, force: boolean = false) {
|
||||
|
||||
@@ -68,6 +68,10 @@ export class GitLogParserEnricher implements IGitEnricher<IGitLog> {
|
||||
|
||||
case 'summary':
|
||||
entry.summary = lineParts.slice(1).join(' ').trim();
|
||||
while (++position < lines.length) {
|
||||
if (!lines[position]) break;
|
||||
entry.summary += `\n${lines[position]}`;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'filename':
|
||||
|
||||
@@ -13,7 +13,7 @@ export * from './enrichers/logParserEnricher';
|
||||
let git: IGit;
|
||||
const UncommittedRegex = /^[0]+$/;
|
||||
|
||||
const DefaultLogParams = [`log`, `--name-status`, `--full-history`, `-m`, `--date=iso8601-strict`, `--format=%H -%nauthor %an%nauthor-date %ai%ncommitter %cn%ncommitter-date %ci%nsummary %s%nfilename ?`];
|
||||
const DefaultLogParams = [`log`, `--name-status`, `--full-history`, `-m`, `--date=iso8601-strict`, `--format=%H -%nauthor %an%nauthor-date %ai%ncommitter %cn%ncommitter-date %ci%nsummary %B%nfilename ?`];
|
||||
|
||||
async function gitCommand(cwd: string, ...args: any[]) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user