diff options
Diffstat (limited to 'makima/src/daemon')
| -rw-r--r-- | makima/src/daemon/worktree/manager.rs | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/makima/src/daemon/worktree/manager.rs b/makima/src/daemon/worktree/manager.rs index 489c488..ea26767 100644 --- a/makima/src/daemon/worktree/manager.rs +++ b/makima/src/daemon/worktree/manager.rs @@ -491,64 +491,7 @@ impl WorktreeManager { .output() .await; - // Prefer origin/{base_branch} to get latest remote state. - // If neither origin/{base_branch} nor {base_branch} exist (e.g. PR branch - // was deleted after merge), fall back to the repo's default branch. - let origin_ref = format!("origin/{}", base_branch); - let has_origin_ref = Command::new("git") - .args(["rev-parse", "--verify", &format!("refs/remotes/{}", origin_ref)]) - .current_dir(source_repo) - .output() - .await - .map(|o| o.status.success()) - .unwrap_or(false); - - let has_local_ref = if !has_origin_ref { - Command::new("git") - .args(["rev-parse", "--verify", &format!("refs/heads/{}", base_branch)]) - .current_dir(source_repo) - .output() - .await - .map(|o| o.status.success()) - .unwrap_or(false) - } else { - false // don't need to check — we already have origin ref - }; - - let start_point: String = if has_origin_ref { - origin_ref - } else if has_local_ref { - base_branch.to_string() - } else { - // Branch doesn't exist (likely deleted after PR merge) — use default branch - tracing::warn!( - task_id = %task_id, - base_branch = %base_branch, - "Base branch ref not found, falling back to default branch" - ); - let default_branch = self.detect_default_branch(source_repo).await?; - let default_origin = format!("origin/{}", default_branch); - let has_default_origin = Command::new("git") - .args(["rev-parse", "--verify", &format!("refs/remotes/{}", default_origin)]) - .current_dir(source_repo) - .output() - .await - .map(|o| o.status.success()) - .unwrap_or(false); - if has_default_origin { - default_origin - } else { - default_branch - } - }; - - tracing::info!( - task_id = %task_id, - start_point = %start_point, - "Using start point for new worktree branch" - ); - - // Create the worktree with a new branch based on the start point + // Create the worktree with a new branch based on the local base_branch let output = Command::new("git") .args([ "worktree", |
