Add base commit and branch to arc run initial output

Shows "Base: main (260a391e5b4c)" after the Worktree line in the run
header, helping users identify the starting point. Uses worktree base
SHA when available, falls back to remote base SHA for remote-only runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-09 12:31:35 -04:00
parent 5f33e01f10
commit eb63a80356
2 changed files with 37 additions and 0 deletions

View file

@ -695,6 +695,24 @@ impl ProgressUI {
}
}
pub fn show_base_info(&mut self, branch: Option<&str>, sha: &str) {
let short_sha = &sha[..sha.len().min(12)];
let text = match branch {
Some(b) => format!("Base: {b} ({short_sha})"),
None => format!("Base: {short_sha}"),
};
match &self.renderer {
ProgressRenderer::Tty(tty) => {
let bar = tty.multi.add(ProgressBar::new_spinner());
bar.set_style(style_static_dim());
bar.finish_with_message(text);
}
ProgressRenderer::Plain => {
eprintln!(" {text}");
}
}
}
// ── Stages ──────────────────────────────────────────────────────────
fn on_stage_started(&mut self, node_id: &str, name: &str, script: Option<&str>) {

View file

@ -550,6 +550,13 @@ pub async fn run_command(
.show_worktree(wt);
}
if let Some(ref sha) = worktree_base_sha {
progress_ui
.lock()
.expect("progress lock poisoned")
.show_base_info(detected_base_branch.as_deref(), sha);
}
let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
let daytona_config = resolve_daytona_config(run_cfg.as_ref(), &run_defaults);
let exe_config = resolve_exe_config(run_cfg.as_ref(), &run_defaults);
@ -715,6 +722,18 @@ pub async fn run_command(
(None, None, None)
};
if worktree_base_sha.is_none() {
if let Some(ref sha) = remote_base_sha {
let branch = detected_base_branch
.as_deref()
.or(remote_base_branch.as_deref());
progress_ui
.lock()
.expect("progress lock poisoned")
.show_base_info(branch, sha);
}
}
// Create SSH access if requested
if args.ssh {
match sandbox.ssh_access_command().await {