mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-24 07:20:16 +05:30
feat(git): add diff, branch, checkout, push, pull to Git sidebar panel
Extends GitOperations.js with diff/branches/checkoutBranch/push/pull, wires the 5 new IPC handlers in main.js (reusing the existing dir resolution), whitelists the new channels in preload.js, and fixes the Git sidebar panel's previously dead _gitDiff callback by wiring up a diff view, branch list/create/checkout UI, and push/pull buttons. Resolves Task 5, which deferred this work to this task. Amit Haridas
This commit is contained in:
+20
@@ -5294,6 +5294,26 @@ ipcMain.handle('git-log', async () => {
|
||||
const dir = currentFile ? path.dirname(currentFile) : process.cwd();
|
||||
return GitOperations.log(dir);
|
||||
});
|
||||
ipcMain.handle('git-diff', async (event, { file } = {}) => {
|
||||
const dir = currentFile ? path.dirname(currentFile) : process.cwd();
|
||||
return GitOperations.diff(dir, file);
|
||||
});
|
||||
ipcMain.handle('git-branches', async () => {
|
||||
const dir = currentFile ? path.dirname(currentFile) : process.cwd();
|
||||
return GitOperations.branches(dir);
|
||||
});
|
||||
ipcMain.handle('git-checkout', async (event, { name, isNew } = {}) => {
|
||||
const dir = currentFile ? path.dirname(currentFile) : process.cwd();
|
||||
return GitOperations.checkoutBranch(dir, name, isNew);
|
||||
});
|
||||
ipcMain.handle('git-push', async () => {
|
||||
const dir = currentFile ? path.dirname(currentFile) : process.cwd();
|
||||
return GitOperations.push(dir);
|
||||
});
|
||||
ipcMain.handle('git-pull', async () => {
|
||||
const dir = currentFile ? path.dirname(currentFile) : process.cwd();
|
||||
return GitOperations.pull(dir);
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// Snippets IPC Handlers
|
||||
|
||||
Reference in New Issue
Block a user