diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-19 18:59:43 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-19 18:59:43 +0300 |
| commit | 46a2b259a71828e7fcdeab1f67ef675304e2ca14 (patch) | |
| tree | 0b8aa654d8977ff24ecb25763e961d4a6fa78615 /src/events.rs | |
| parent | 26c5f97a908c1ebe4228302d1b9e8c5423b2ab75 (diff) | |
fix: defer api worktree operations
refs #686
refs #657
refs #662
refs https://github.com/ogulcancelik/herdr/discussions/687
Diffstat (limited to 'src/events.rs')
| -rw-r--r-- | src/events.rs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/events.rs b/src/events.rs index 558d826e..d9405989 100644 --- a/src/events.rs +++ b/src/events.rs @@ -10,18 +10,44 @@ 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<String>, + pub source_existing_membership: Option<crate::workspace::WorktreeSpaceMembership>, + 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<String>, + pub focus: bool, + pub respond_to: std::sync::mpsc::Sender<String>, +} + +#[derive(Debug)] pub struct WorktreeAddResult { pub path: std::path::PathBuf, + pub api_request: Option<ApiWorktreeAddRequest>, 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<String>, +} + +#[derive(Debug)] pub struct WorktreeRemoveResult { pub workspace_id: String, pub path: std::path::PathBuf, pub workspace: Option<Box<crate::api::schema::WorkspaceInfo>>, pub worktree: Option<Box<crate::api::schema::WorktreeInfo>>, pub forced: bool, + pub api_request: Option<ApiWorktreeRemoveRequest>, pub result: Result<(), String>, } @@ -125,7 +151,7 @@ pub enum AppEvent { error: Option<String>, }, /// Background `git worktree add` completed. - WorktreeAddFinished(WorktreeAddResult), + WorktreeAddFinished(Box<WorktreeAddResult>), /// Background `git worktree remove` completed. - WorktreeRemoveFinished(WorktreeRemoveResult), + WorktreeRemoveFinished(Box<WorktreeRemoveResult>), } |
