Browse Source

Fixes issue with newlines in commit messages

main
Eric Amodio 7 years ago
parent
commit
89474a2aa6
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      src/quickPicks/common.ts

+ 8
- 2
src/quickPicks/common.ts View File

@ -117,13 +117,19 @@ export class CommitQuickPickItem implements QuickPickItem {
detail: string;
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) {
this.label = `${commit.stashName}\u00a0\u2022\u00a0${commit.message}`;
this.label = `${commit.stashName}\u00a0\u2022\u00a0${message}`;
this.description = null;
this.detail = `\u00a0 ${moment(commit.date).fromNow()}\u00a0\u00a0\u2022\u00a0 ${commit.getDiffStatus()}`;
}
else {
this.label = commit.message;
this.label = message;
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()}` : ''}`;
}

Loading…
Cancel
Save