Skip to content

Commit b7ead45

Browse files
committed
Ensures missing status is undefined
1 parent 89dbefb commit b7ead45

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/git/parsers/statusParser.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,15 @@ export class GitStatusParser {
110110
}
111111

112112
static parseStatusFile(repoPath: string, rawStatus: string, fileName: string, originalFileName?: string): GitStatusFile {
113-
const indexStatus = rawStatus[0] !== '.' ? rawStatus[0].trim() : undefined;
114-
const workTreeStatus = rawStatus[1] !== '.' ? rawStatus[1].trim() : undefined;
113+
let indexStatus = rawStatus[0] !== '.' ? rawStatus[0].trim() : undefined;
114+
if (indexStatus === '' || indexStatus === null) {
115+
indexStatus = undefined;
116+
}
117+
118+
let workTreeStatus = rawStatus[1] !== '.' ? rawStatus[1].trim() : undefined;
119+
if (workTreeStatus === '' || workTreeStatus === null) {
120+
workTreeStatus = undefined;
121+
}
115122

116123
return new GitStatusFile(
117124
repoPath,

0 commit comments

Comments
 (0)