From b7ead45d78ef99778d7fe95f8104311c919bd1a3 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 22 Nov 2017 02:20:55 -0500 Subject: [PATCH] Ensures missing status is undefined --- src/git/parsers/statusParser.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/git/parsers/statusParser.ts b/src/git/parsers/statusParser.ts index 2e9465e..a2e6b0c 100644 --- a/src/git/parsers/statusParser.ts +++ b/src/git/parsers/statusParser.ts @@ -110,8 +110,15 @@ export class GitStatusParser { } static parseStatusFile(repoPath: string, rawStatus: string, fileName: string, originalFileName?: string): GitStatusFile { - const indexStatus = rawStatus[0] !== '.' ? rawStatus[0].trim() : undefined; - const workTreeStatus = rawStatus[1] !== '.' ? rawStatus[1].trim() : undefined; + let indexStatus = rawStatus[0] !== '.' ? rawStatus[0].trim() : undefined; + if (indexStatus === '' || indexStatus === null) { + indexStatus = undefined; + } + + let workTreeStatus = rawStatus[1] !== '.' ? rawStatus[1].trim() : undefined; + if (workTreeStatus === '' || workTreeStatus === null) { + workTreeStatus = undefined; + } return new GitStatusFile( repoPath,