summaryrefslogtreecommitdiff
path: root/src/events.rs
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-22 18:43:12 +0200
committerGitHub <noreply@github.com>2026-09-22 19:43:12 +0300
commitdd33ddf28d693b2c64ed91f75656c61416ee2538 (patch)
tree229769fa9e2535b72dc39ba0f64593ef5fdc93a2 /src/events.rs
parent1c6397b1cddb288099ed212a5979732698bd72c2 (diff)
fix: move worktree lookups async (#4492)
Diffstat (limited to 'src/events.rs')
-rw-r--r--src/events.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/events.rs b/src/events.rs
index 95638991..a614ee0c 100644
--- a/src/events.rs
+++ b/src/events.rs
@@ -52,6 +52,27 @@ pub struct WorktreeRemoveResult {
pub result: Result<(), String>,
}
+#[derive(Debug)]
+pub struct WorktreeReadResult {
+ // Keep the slot until completion is consumed, including time queued on the app loop.
+ pub(crate) _permit: tokio::sync::OwnedSemaphorePermit,
+ pub(crate) client_local: bool,
+ pub(crate) request: crate::api::schema::Request,
+ pub(crate) source_workspace_id: Option<String>,
+ pub(crate) source_cwd: Option<std::path::PathBuf>,
+ pub(crate) result: Result<WorktreeReadData, (String, String)>,
+ pub(crate) respond_to: std::sync::mpsc::Sender<String>,
+}
+
+#[derive(Debug)]
+pub(crate) struct WorktreeReadData {
+ pub source_checkout_path: std::path::PathBuf,
+ pub source_repo_root: std::path::PathBuf,
+ pub repo_key: String,
+ pub repo_name: String,
+ pub entries: Vec<crate::worktree::ExistingWorktree>,
+}
+
/// An event from a background task to the main loop.
#[derive(Debug)]
pub enum AppEvent {
@@ -173,4 +194,6 @@ pub enum AppEvent {
WorktreeAddFinished(Box<WorktreeAddResult>),
/// Background `git worktree remove` completed.
WorktreeRemoveFinished(Box<WorktreeRemoveResult>),
+ /// Background worktree discovery completed for an API list/open request.
+ WorktreeReadFinished(Box<WorktreeReadResult>),
}