@@ -361,50 +361,14 @@ impl RenderOnce for ThreadItem {
let has_timestamp = !self.timestamp.is_empty();
let timestamp = self.timestamp;
- let visible_worktree_count = self
- .worktrees
- .iter()
- .filter(|wt| !(wt.kind == WorktreeKind::Main && wt.branch_name.is_none()))
- .count();
-
let mut worktree_labels: Vec<AnyElement> = Vec::new();
let slash_color = Color::Custom(cx.theme().colors().text_muted.opacity(0.4));
for wt in self.worktrees {
- match (wt.kind, wt.branch_name) {
- (WorktreeKind::Main, None) => continue,
- (WorktreeKind::Main, Some(branch)) => {
- let chip_index = worktree_labels.len();
-
- worktree_labels.push(
- h_flex()
- .id(format!("{}-worktree-{chip_index}", self.id.clone()))
- .min_w_0()
- .when(visible_worktree_count > 1, |this| {
- this.child(
- Label::new(wt.name)
- .size(LabelSize::Small)
- .color(Color::Muted)
- .truncate(),
- )
- .child(
- Label::new("/")
- .size(LabelSize::Small)
- .color(slash_color)
- .flex_shrink_0(),
- )
- })
- .child(
- Label::new(branch)
- .size(LabelSize::Small)
- .color(Color::Muted)
- .truncate(),
- )
- .into_any_element(),
- );
- }
- (WorktreeKind::Linked, branch) => {
+ match wt.kind {
+ WorktreeKind::Main => continue,
+ WorktreeKind::Linked => {
let chip_index = worktree_labels.len();
let label = if wt.highlight_positions.is_empty() {
@@ -432,7 +396,7 @@ impl RenderOnce for ThreadItem {
.color(Color::Muted),
)
.child(label)
- .when_some(branch, |this, branch| {
+ .when_some(wt.branch_name, |this, branch| {
this.child(
Label::new("/")
.size(LabelSize::Small)
@@ -861,7 +825,7 @@ impl Component for ThreadItem {
.into_any_element(),
),
single_example(
- "Main Branch + Changes + Timestamp",
+ "Main Worktree (hidden) + Changes + Timestamp",
container()
.child(
ThreadItem::new("ti-5e", "Main worktree branch with diff stats")
@@ -2939,9 +2939,7 @@ impl gpui::Render for ThreadItemBranchNameTestView {
}]),
),
)
- .child(section_label(
- "Main worktree with branch (branch only, no icon)",
- ))
+ .child(section_label("Main worktree with branch (nothing shown)"))
.child(
container().child(
ThreadItem::new("ti-main-branch", "Request for Long Classic Poem")
@@ -3043,7 +3041,9 @@ impl gpui::Render for ThreadItemBranchNameTestView {
}]),
),
)
- .child(section_label("Main branch + diff stats + timestamp"))
+ .child(section_label(
+ "Main worktree with branch + diff stats + timestamp (branch hidden)",
+ ))
.child(
container().child(
ThreadItem::new("ti-main-full", "Main worktree with everything")