diff --git a/crates/ide-agent/src/lib.rs b/crates/ide-agent/src/lib.rs index e2b7fd46..f58cd5da 100644 --- a/crates/ide-agent/src/lib.rs +++ b/crates/ide-agent/src/lib.rs @@ -577,7 +577,13 @@ impl Task { fn cwd_and_base(&self) -> (PathBuf, String) { let s = self.state.lock(); - (s.task.cwd.0.clone(), s.task.base_commit.clone().unwrap_or_else(|| "HEAD".into())) + // In the project's own checkout the user commits too: compare against the current HEAD, + // as the Commit tool window does, so commits made since the task started drop out. + let base = match s.task.isolation { + Isolation::Local => None, + Isolation::Worktree => s.task.base_commit.clone(), + }; + (s.task.cwd.0.clone(), base.unwrap_or_else(|| "HEAD".into())) } fn emit_task(&self) { diff --git a/crates/ide-agent/src/model.rs b/crates/ide-agent/src/model.rs index 50276ca6..369882ee 100644 --- a/crates/ide-agent/src/model.rs +++ b/crates/ide-agent/src/model.rs @@ -44,7 +44,7 @@ pub struct AgentTask { pub branch: Option, /// Branch (or revision) the worktree was created from. pub base: Option, - /// Commit the task's changes are compared against. + /// Commit the task's changes are compared against (worktree tasks; local ones use `HEAD`). pub base_commit: Option, /// Why the task failed, when it did. pub error: Option,