Refactor 'has-diffs' handler to check for relocation and file existence
This commit is contained in:
10
main.js
10
main.js
@@ -803,11 +803,19 @@ app.whenReady().then(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Prüfe, ob es ungestagte Änderungen gibt
|
// 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 git = simpleGit(folderObj.path);
|
||||||
const status = await git.status();
|
const status = await git.status();
|
||||||
// modified, not_added, deleted, etc.
|
// modified, not_added, deleted, etc.
|
||||||
return status.files.length > 0;
|
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
|
// Entferne das .git-Verzeichnis
|
||||||
|
|||||||
Reference in New Issue
Block a user