Skip to content

Commit 1762764

Browse files
authored
Merge pull request #83 from beNative/codex/refactor-check-vcs-status-for-svn-path-logic
Improve SVN dirty modal parsing
2 parents 22985c6 + 41e9e4d commit 1762764

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

electron/main.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,8 +1438,32 @@ ipcMain.handle('check-vcs-status', async (event, repo: Repository): Promise<{ is
14381438
return;
14391439
}
14401440
const output = stdout.trim();
1441-
const isDirty = output.length > 0;
1442-
resolve({ isDirty, output, untrackedFiles: [], changedFiles: isDirty ? [output] : [] });
1441+
const untrackedFiles: string[] = [];
1442+
const changedFiles: string[] = [];
1443+
1444+
if (output.length > 0) {
1445+
stdout.split(/\r?\n/).forEach(line => {
1446+
const trimmedLine = line.trim();
1447+
if (!trimmedLine) {
1448+
return;
1449+
}
1450+
const statusCode = trimmedLine[0];
1451+
const filePath = trimmedLine.slice(1).trim();
1452+
1453+
if (!filePath) {
1454+
return;
1455+
}
1456+
1457+
if (statusCode === '?') {
1458+
untrackedFiles.push(filePath);
1459+
} else {
1460+
changedFiles.push(filePath);
1461+
}
1462+
});
1463+
}
1464+
1465+
const isDirty = untrackedFiles.length > 0 || changedFiles.length > 0;
1466+
resolve({ isDirty, output, untrackedFiles, changedFiles });
14431467
});
14441468
});
14451469
}

0 commit comments

Comments
 (0)