From 353934c675955462764cfd21eb2f46fe5702f59a Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 15 Nov 2018 17:07:09 -0500 Subject: [PATCH] Fixes #544 - stop sometimes clipping the last char of a log message --- src/git/parsers/logParser.ts | 4 ++-- src/git/parsers/stashParser.ts | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index 25c9a94..184ebb3 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -124,8 +124,8 @@ export class GitLogParser { } } - if (entry.summary !== undefined) { - // Remove the trailing newline + // Remove the trailing newline + if (entry.summary != null && entry.summary.charCodeAt(entry.summary.length - 1) === 10) { entry.summary = entry.summary.slice(0, -1); } break; diff --git a/src/git/parsers/stashParser.ts b/src/git/parsers/stashParser.ts index efc03e8..f2d9870 100644 --- a/src/git/parsers/stashParser.ts +++ b/src/git/parsers/stashParser.ts @@ -79,8 +79,8 @@ export class GitStashParser { } } - if (entry.summary !== undefined) { - // Remove the trailing newline + // Remove the trailing newline + if (entry.summary != null && entry.summary.charCodeAt(entry.summary.length - 1) === 10) { entry.summary = entry.summary.slice(0, -1); } break; @@ -114,9 +114,8 @@ export class GitStashParser { } if (entry.files !== undefined) { - entry.fileNames = Arrays.filterMap( - entry.files, - f => (f.fileName ? f.fileName : undefined) + entry.fileNames = Arrays.filterMap(entry.files, f => + f.fileName ? f.fileName : undefined ).join(', '); } }