Suppress the current detached worktree’s textual `@directory` decoration in history rows because the graph marker already identifies HEAD with `@`. Keep foreign detached worktree labels, detached-worktree discovery, dirty-state display, and ref-tree decorations unchanged.
Unified · Split
| @@ -138,7 +138,9 @@ without trading responsiveness for metadata that is not visible. · 137 unmodified lines | ||
| 138 | 138 | A detached foreign worktree is shown as `directory@` at its actual `HEAD`, |
| 139 | 139 | without a pin marker. Its symbolic HEAD pin is shown separately as `★branch` |
| 140 | 140 | at that branch's actual tip. The worktree administration name is used when no |
| 141 | − directory basename is available. Identical labels are deduplicated. | |
| 141 | + directory basename is available. A detached current worktree is identified by | |
| 142 | + the graph `@` alone and has no redundant `@directory` label. Identical labels | |
| 143 | + are deduplicated. | |
| 142 | 144 | - When reference labels are hidden, worktree labels are visible only on the |
| 143 | 145 | selected row. Stale, malformed, unborn, and otherwise unreadable worktree |
| 144 | 146 | entries are skipped without failing history loading. |
| @@ -1749,6 +1749,7 @@ fn metadata_line<'a>( · 1748 unmodified lines | ||
| 1749 | 1749 | let mut labels = row_decorations |
| 1750 | 1750 | .iter() |
| 1751 | 1751 | .filter(|decoration| !matches!(decoration.kind, DecorationKind::Pin | DecorationKind::Stash)) |
| 1752 | + .filter(|decoration| decoration.kind != DecorationKind::CurrentWorktreeDetached) | |
| 1752 | 1753 | .filter(|decoration| match ref_mode { |
| 1753 | 1754 | _ if decoration.kind == DecorationKind::Head => false, |
| 1754 | 1755 | _ if decoration.kind == DecorationKind::Review => true, |
| @@ -3293,6 +3294,10 @@ mod tests { · 1538 unmodified lines | ||
| 3293 | 3294 | name: "detached".into(), |
| 3294 | 3295 | kind: DecorationKind::WorktreeDetached, |
| 3295 | 3296 | }, |
| 3297 | + Decoration { | |
| 3298 | + name: "current-detached".into(), | |
| 3299 | + kind: DecorationKind::CurrentWorktreeDetached, | |
| 3300 | + }, | |
| 3296 | 3301 | Decoration { |
| 3297 | 3302 | name: "HEAD".into(), |
| 3298 | 3303 | kind: DecorationKind::Head, |
| @@ -3305,6 +3310,10 @@ mod tests { · 6 unmodified lines | ||
| 3305 | 3310 | assert!(row.contains("@current")); |
| 3306 | 3311 | assert!(row.contains("main@")); |
| 3307 | 3312 | assert!(row.contains("detached@")); |
| 3313 | + assert!( | |
| 3314 | + !row.contains("current-detached"), | |
| 3315 | + "the graph @ already identifies the current detached worktree" | |
| 3316 | + ); | |
| 3308 | 3317 | assert!(!row.contains("HEAD"), "a worktree label replaces textual HEAD"); |
| 3309 | 3318 | let x = row.find("main@").expect("the worktree label is visible") as u16; |
| 3310 | 3319 | assert_eq!(terminal.backend().buffer()[(x, 0)].fg, Color::LightBlue); |