From 4629cda0d557d3e3548b7fe9c2334b29e02dd57b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 6 Feb 2018 15:45:47 -0500 Subject: [PATCH] Fixes parsing of the last file commit's file --- CHANGELOG.md | 1 + src/git/parsers/logParser.ts | 2 +- src/git/parsers/stashParser.ts | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e6f5e..7feb3cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Fixes [#35](https://github.com/eamodio/vscode-gitlens/issues/35) - Copy Commit Sha to Clipboard not working (linux) +- Fixes issue where the last commit of a file history would be broken (failed to parse correctly) ## [8.0.0-beta3] - 2018-02-03 ### Added diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index 43bd941..039d1d7 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -41,7 +41,7 @@ export class GitLogParser { let i = 0; let first = true; - const lines = Strings.lines(data + '\n'); + const lines = Strings.lines(data + ''); // Skip the first line since it will always be let next = lines.next(); if (next.done) return undefined; diff --git a/src/git/parsers/stashParser.ts b/src/git/parsers/stashParser.ts index 57c23db..efac085 100644 --- a/src/git/parsers/stashParser.ts +++ b/src/git/parsers/stashParser.ts @@ -17,7 +17,9 @@ const emptyEntry: StashEntry = {}; export class GitStashParser { static parse(data: string, repoPath: string): GitStash | undefined { - const lines = Strings.lines(data + '\n'); + if (!data) return undefined; + + const lines = Strings.lines(data + ''); // Skip the first line since it will always be let next = lines.next(); if (next.done) return undefined;