From 221b3a69d6bb8cdeb2cf944ef618d882b0e24575 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 17 Mar 2026 16:25:40 -0400 Subject: [PATCH] Always show branch name in sidebar --- crates/sidebar/src/sidebar.rs | 9 ++++++++- crates/ui/src/components/ai/thread_item.rs | 20 +++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 4ffa3efa92f4a53fcb7262b5993cfc62dc533e6d..87cad2725a6f87bfd42c62f6644703a00c6fd4af 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -567,6 +567,13 @@ impl Sidebar { if should_load_threads { let mut seen_session_ids: HashSet = HashSet::new(); + // Get the current branch name from the workspace's root repository. + let workspace_branch_name: Option = + root_repository_snapshots(workspace, cx) + .first() + .and_then(|snapshot| snapshot.branch.as_ref()) + .map(|branch| SharedString::from(branch.name().to_string())); + // Read threads from SidebarDb for this workspace's path list. if let Some(rows) = threads_by_paths.get(&path_list) { for row in rows { @@ -602,7 +609,7 @@ impl Sidebar { is_background: false, is_title_generating: false, highlight_positions: Vec::new(), - worktree_name: None, + worktree_name: workspace_branch_name.clone(), worktree_path: None, worktree_highlight_positions: Vec::new(), diff_stats: DiffStats::default(), diff --git a/crates/ui/src/components/ai/thread_item.rs b/crates/ui/src/components/ai/thread_item.rs index d2a4f6cb6b07cd770892408ff1753fc931f8f3b2..4a548038440a80e61511068074cd107beb911906 100644 --- a/crates/ui/src/components/ai/thread_item.rs +++ b/crates/ui/src/components/ai/thread_item.rs @@ -346,15 +346,17 @@ impl RenderOnce for ThreadItem { .min_w_0() .gap_1p5() .child(icon_container()) // Icon Spacing - .when(worktree_path.is_some(), |this| { - this.child( - div().child( - Icon::new(IconName::GitBranch) - .size(IconSize::XSmall) - .color(Color::Muted), - ), - ) - }) + .child( + div().child( + Icon::new(if worktree_path.is_some() { + IconName::GitBranch + } else { + IconName::GitBranchAlt + }) + .size(IconSize::XSmall) + .color(Color::Muted), + ), + ) .child(worktree_label) .when(has_diff_stats || has_timestamp, |this| { this.child(dot_separator())