From 46a2b259a71828e7fcdeab1f67ef675304e2ca14 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Fri, 19 Jun 2026 18:59:43 +0300 Subject: fix: defer api worktree operations refs #686 refs #657 refs #662 refs https://github.com/ogulcancelik/herdr/discussions/687 --- src/events.rs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/events.rs') diff --git a/src/events.rs b/src/events.rs index 558d826e..d9405989 100644 --- a/src/events.rs +++ b/src/events.rs @@ -9,12 +9,37 @@ use crate::detect::{Agent, AgentState}; use crate::layout::PaneId; use crate::workspace::{GitStatusCacheEntry, WorkspaceGitStatus}; +#[derive(Debug)] +pub struct ApiWorktreeAddRequest { + pub id: String, + pub operation_id: u64, + pub checkout_key: std::path::PathBuf, + pub source_workspace_id: Option, + pub source_existing_membership: Option, + pub source_checkout_path: std::path::PathBuf, + pub source_repo_root: std::path::PathBuf, + pub repo_key: String, + pub repo_name: String, + pub label: Option, + pub focus: bool, + pub respond_to: std::sync::mpsc::Sender, +} + #[derive(Debug)] pub struct WorktreeAddResult { pub path: std::path::PathBuf, + pub api_request: Option, pub result: Result<(), String>, } +#[derive(Debug)] +pub struct ApiWorktreeRemoveRequest { + pub id: String, + pub operation_id: u64, + pub checkout_key: std::path::PathBuf, + pub respond_to: std::sync::mpsc::Sender, +} + #[derive(Debug)] pub struct WorktreeRemoveResult { pub workspace_id: String, @@ -22,6 +47,7 @@ pub struct WorktreeRemoveResult { pub workspace: Option>, pub worktree: Option>, pub forced: bool, + pub api_request: Option, pub result: Result<(), String>, } @@ -125,7 +151,7 @@ pub enum AppEvent { error: Option, }, /// Background `git worktree add` completed. - WorktreeAddFinished(WorktreeAddResult), + WorktreeAddFinished(Box), /// Background `git worktree remove` completed. - WorktreeRemoveFinished(WorktreeRemoveResult), + WorktreeRemoveFinished(Box), } -- cgit v1.2.3