mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-15 10:58:36 -05:00
Fixes issue with newlines in commit messages
This commit is contained in:
@@ -117,13 +117,19 @@ export class CommitQuickPickItem implements QuickPickItem {
|
|||||||
detail: string;
|
detail: string;
|
||||||
|
|
||||||
constructor(public commit: GitCommit) {
|
constructor(public commit: GitCommit) {
|
||||||
|
let message = commit.message;
|
||||||
|
const index = message.indexOf('\n');
|
||||||
|
if (index !== -1) {
|
||||||
|
message = `${message.substring(0, index)}\u00a0$(ellipsis)`;
|
||||||
|
}
|
||||||
|
|
||||||
if (commit instanceof GitStashCommit) {
|
if (commit instanceof GitStashCommit) {
|
||||||
this.label = `${commit.stashName}\u00a0\u2022\u00a0${commit.message}`;
|
this.label = `${commit.stashName}\u00a0\u2022\u00a0${message}`;
|
||||||
this.description = null;
|
this.description = null;
|
||||||
this.detail = `\u00a0 ${moment(commit.date).fromNow()}\u00a0\u00a0\u2022\u00a0 ${commit.getDiffStatus()}`;
|
this.detail = `\u00a0 ${moment(commit.date).fromNow()}\u00a0\u00a0\u2022\u00a0 ${commit.getDiffStatus()}`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.label = commit.message;
|
this.label = message;
|
||||||
this.description = `\u00a0$(git-commit)\u00a0 ${commit.shortSha}`;
|
this.description = `\u00a0$(git-commit)\u00a0 ${commit.shortSha}`;
|
||||||
this.detail = `\u00a0 ${commit.author}, ${moment(commit.date).fromNow()}${(commit.type === 'branch') ? `\u00a0\u00a0\u2022\u00a0 ${(commit as GitLogCommit).getDiffStatus()}` : ''}`;
|
this.detail = `\u00a0 ${commit.author}, ${moment(commit.date).fromNow()}${(commit.type === 'branch') ? `\u00a0\u00a0\u2022\u00a0 ${(commit as GitLogCommit).getDiffStatus()}` : ''}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user