1
0

Add new endpoint to retrieve all commit hashes from a Git repository

This commit is contained in:
2025-05-26 21:44:28 +02:00
parent e0343bdb54
commit 1118af8111

19
main.js
View File

@@ -1372,6 +1372,25 @@ function buildTrayMenu() {
ipcMain.handle('get-daily-commit-stats', () => store.get('dailyCommitStats') || {});
ipcMain.handle('get-all-commit-hashes', async (_e, folderObj) => {
try {
if (folderObj.needsRelocation || !fs.existsSync(folderObj.path)) {
return [];
}
const git = simpleGit(folderObj.path);
// Wir holen ALLE Commits, HEAD → root
const log = await git.log(['--all']);
// Rückgabe: Array mit vollständigen Hashes (du kannst auch .substring(0, 7) nehmen, falls du überall Short-Hashes verwendest)
return log.all.map(c => c.hash);
} catch (err) {
return [];
}
});
// … Ende der IPC-Handler …