1
0

Add IPC handler to check if commit exists in any branch of the repository

This commit is contained in:
2025-05-25 05:07:18 +02:00
parent 8d7f1c41d6
commit d4c83d8df5

15
main.js
View File

@@ -1129,6 +1129,21 @@ app.whenReady().then(() => {
return result.canceled ? null : result.filePaths;
});
ipcMain.handle('repo-has-commit', async (_e, repoPath, commitHash) => {
try {
const git = simpleGit(repoPath);
// Perform a git log to check if the commit exists anywhere in the history
const result = await git.raw(['branch', '--contains', commitHash]);
// Falls irgendein Branch den Commit enthält, ist das unser Repo!
return result.trim().length > 0;
} catch {
return false;
}
});
// … Ende der IPC-Handler …