summaryrefslogtreecommitdiff
path: root/makima/src/daemon/task/manager.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/daemon/task/manager.rs')
-rw-r--r--makima/src/daemon/task/manager.rs45
1 files changed, 31 insertions, 14 deletions
diff --git a/makima/src/daemon/task/manager.rs b/makima/src/daemon/task/manager.rs
index a24f527..22b41d9 100644
--- a/makima/src/daemon/task/manager.rs
+++ b/makima/src/daemon/task/manager.rs
@@ -5587,8 +5587,8 @@ impl TaskManagerInner {
let target_repo = match target_repo_path {
Some(path) => Some(crate::daemon::worktree::expand_tilde(path)),
None => {
- if action == "pr" {
- // For PR action, check if worktree has an origin remote we can use directly
+ if action == "pr" || action == "branch" {
+ // For PR/branch action without target_repo, use origin directly
None
} else {
tracing::warn!(task_id = %task_id, "No target_repo_path configured, skipping completion action");
@@ -5633,19 +5633,36 @@ impl TaskManagerInner {
match action {
"branch" => {
- let target_repo = target_repo.ok_or_else(|| "No target_repo_path configured for branch action".to_string())?;
- // Just push the branch to target repo
- self.worktree_manager
- .push_to_target_repo(worktree_path, &target_repo, &branch_name, task_name)
- .await
- .map_err(|e| e.to_string())?;
+ match target_repo {
+ Some(target_repo) => {
+ // Push branch to local target repo
+ self.worktree_manager
+ .push_to_target_repo(worktree_path, &target_repo, &branch_name, task_name)
+ .await
+ .map_err(|e| e.to_string())?;
- let msg = DaemonMessage::task_output(
- task_id,
- format!("Branch '{}' pushed to {}\n", branch_name, target_repo.display()),
- false,
- );
- let _ = self.ws_tx.send(msg).await;
+ let msg = DaemonMessage::task_output(
+ task_id,
+ format!("Branch '{}' pushed to {}\n", branch_name, target_repo.display()),
+ false,
+ );
+ let _ = self.ws_tx.send(msg).await;
+ }
+ None => {
+ // Push branch to origin (GitHub)
+ self.worktree_manager
+ .push_branch_to_origin(worktree_path, &branch_name, task_name)
+ .await
+ .map_err(|e| e.to_string())?;
+
+ let msg = DaemonMessage::task_output(
+ task_id,
+ format!("Branch '{}' pushed to origin\n", branch_name),
+ false,
+ );
+ let _ = self.ws_tx.send(msg).await;
+ }
+ }
Ok(None)
}
"merge" => {