From d4c83d8df564d138fba0e40923589c88eb1e1202 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 25 May 2025 05:07:18 +0200 Subject: [PATCH] Add IPC handler to check if commit exists in any branch of the repository --- main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/main.js b/main.js index 6ab5ec3..77c95c0 100644 --- a/main.js +++ b/main.js @@ -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 …