History

fix: omit redundant detached-worktree labels

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.

Codex committed 3 months ago

Commit 088b8251 parent b78ba472 files · +12 −1Browse files

Unified · Split

2 files
  1. gix-tix/spec.md +3 −1
  2. gix-tix/src/ui.rs +9 −0
gix-tix/spec.md+3−1
@@ -138,7 +138,9 @@ without trading responsiveness for metadata that is not visible. · 137 unmodified lines
138 A detached foreign worktree is shown as `directory@` at its actual `HEAD`,138 A detached foreign worktree is shown as `directory@` at its actual `HEAD`,
139 without a pin marker. Its symbolic HEAD pin is shown separately as `★branch`139 without a pin marker. Its symbolic HEAD pin is shown separately as `★branch`
140 at that branch's actual tip. The worktree administration name is used when no140 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- When reference labels are hidden, worktree labels are visible only on the144- When reference labels are hidden, worktree labels are visible only on the
143 selected row. Stale, malformed, unborn, and otherwise unreadable worktree145 selected row. Stale, malformed, unborn, and otherwise unreadable worktree
144 entries are skipped without failing history loading.146 entries are skipped without failing history loading.
gix-tix/src/ui.rs+9−0
@@ -1749,6 +1749,7 @@ fn metadata_line<'a>( · 1748 unmodified lines
1749 let mut labels = row_decorations1749 let mut labels = row_decorations
1750 .iter()1750 .iter()
1751 .filter(|decoration| !matches!(decoration.kind, DecorationKind::Pin | DecorationKind::Stash))1751 .filter(|decoration| !matches!(decoration.kind, DecorationKind::Pin | DecorationKind::Stash))
1752 .filter(|decoration| decoration.kind != DecorationKind::CurrentWorktreeDetached)
1752 .filter(|decoration| match ref_mode {1753 .filter(|decoration| match ref_mode {
1753 _ if decoration.kind == DecorationKind::Head => false,1754 _ if decoration.kind == DecorationKind::Head => false,
1754 _ if decoration.kind == DecorationKind::Review => true,1755 _ if decoration.kind == DecorationKind::Review => true,
@@ -3293,6 +3294,10 @@ mod tests { · 1538 unmodified lines
3293 name: "detached".into(),3294 name: "detached".into(),
3294 kind: DecorationKind::WorktreeDetached,3295 kind: DecorationKind::WorktreeDetached,
3295 },3296 },
3297 Decoration {
3298 name: "current-detached".into(),
3299 kind: DecorationKind::CurrentWorktreeDetached,
3300 },
3296 Decoration {3301 Decoration {
3297 name: "HEAD".into(),3302 name: "HEAD".into(),
3298 kind: DecorationKind::Head,3303 kind: DecorationKind::Head,
@@ -3305,6 +3310,10 @@ mod tests { · 6 unmodified lines
3305 assert!(row.contains("@current"));3310 assert!(row.contains("@current"));
3306 assert!(row.contains("main@"));3311 assert!(row.contains("main@"));
3307 assert!(row.contains("detached@"));3312 assert!(row.contains("detached@"));
3313 assert!(
3314 !row.contains("current-detached"),
3315 "the graph @ already identifies the current detached worktree"
3316 );
3308 assert!(!row.contains("HEAD"), "a worktree label replaces textual HEAD");3317 assert!(!row.contains("HEAD"), "a worktree label replaces textual HEAD");
3309 let x = row.find("main@").expect("the worktree label is visible") as u16;3318 let x = row.find("main@").expect("the worktree label is visible") as u16;
3310 assert_eq!(terminal.backend().buffer()[(x, 0)].fg, Color::LightBlue);3319 assert_eq!(terminal.backend().buffer()[(x, 0)].fg, Color::LightBlue);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t