diff options
Diffstat (limited to 'makima/src/daemon')
| -rw-r--r-- | makima/src/daemon/task/manager.rs | 33 | ||||
| -rw-r--r-- | makima/src/daemon/ws/protocol.rs | 9 |
2 files changed, 42 insertions, 0 deletions
diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs index acdf4ad..ca97453 100644 --- a/makima/src/daemon/task/manager.rs +++ b/makima/src/daemon/task/manager.rs @@ -3672,6 +3672,39 @@ impl TaskManager { Ok(()) } + /// Resolve the best diff base reference for a given base branch. + /// Tries origin/{base} first, then falls back to local {base} branch. + async fn resolve_diff_base(path: &std::path::PathBuf, base: &str) -> Option<String> { + // Try origin/{base} first + let origin_ref = format!("origin/{}", base); + let check_origin = tokio::process::Command::new("git") + .current_dir(path) + .args(["rev-parse", "--verify", &origin_ref]) + .output() + .await; + + if let Ok(output) = check_origin { + if output.status.success() { + return Some(format!("origin/{}...HEAD", base)); + } + } + + // Fall back to local branch + let check_local = tokio::process::Command::new("git") + .current_dir(path) + .args(["rev-parse", "--verify", base]) + .output() + .await; + + if let Ok(output) = check_local { + if output.status.success() { + return Some(format!("{}...HEAD", base)); + } + } + + None + } + /// Handle GetWorktreeDiff command - get git diff for a task's worktree. async fn handle_get_worktree_diff( &self, diff --git a/makima/src/daemon/ws/protocol.rs b/makima/src/daemon/ws/protocol.rs index 0583783..ced653b 100644 --- a/makima/src/daemon/ws/protocol.rs +++ b/makima/src/daemon/ws/protocol.rs @@ -348,6 +348,15 @@ pub enum DaemonMessage { error: Option<String>, }, + /// Response to GetWorktreeDiff command. + WorktreeDiffResult { + #[serde(rename = "taskId")] + task_id: Uuid, + success: bool, + diff: Option<String>, + error: Option<String>, + }, + /// Response to CreateCheckpoint command. CheckpointCreated { #[serde(rename = "taskId")] |
