Browse Source

Ensures missing status is undefined

main
Eric Amodio 7 years ago
parent
commit
b7ead45d78
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      src/git/parsers/statusParser.ts

+ 9
- 2
src/git/parsers/statusParser.ts View File

@ -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,

Loading…
Cancel
Save