1
0

Refactor 'has-diffs' handler to check for relocation and file existence

This commit is contained in:
2025-05-25 05:17:54 +02:00
parent 2bd9ecb4b7
commit aaacaa9e2d

10
main.js
View File

@@ -803,11 +803,19 @@ app.whenReady().then(() => {
});
// Prüfe, ob es ungestagte Änderungen gibt
ipcMain.handle('has-diffs', async (_e, folderObj) => {
/*ipcMain.handle('has-diffs', async (_e, folderObj) => {
const git = simpleGit(folderObj.path);
const status = await git.status();
// modified, not_added, deleted, etc.
return status.files.length > 0;
});*/
ipcMain.handle('has-diffs', async (_e, folderObj) => {
if (folderObj.needsRelocation || !fs.existsSync(folderObj.path)) {
return false;
}
const git = simpleGit(folderObj.path);
const status = await git.status();
return status.files.length > 0;
});
// Entferne das .git-Verzeichnis