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
138138 A detached foreign worktree is shown as `directory@` at its actual `HEAD`,
139139 without a pin marker. Its symbolic HEAD pin is shown separately as `★branch`
140140 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.
142144 - When reference labels are hidden, worktree labels are visible only on the
143145 selected row. Stale, malformed, unborn, and otherwise unreadable worktree
144146 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
17491749 let mut labels = row_decorations
17501750 .iter()
17511751 .filter(|decoration| !matches!(decoration.kind, DecorationKind::Pin | DecorationKind::Stash))
1752+ .filter(|decoration| decoration.kind != DecorationKind::CurrentWorktreeDetached)
17521753 .filter(|decoration| match ref_mode {
17531754 _ if decoration.kind == DecorationKind::Head => false,
17541755 _ if decoration.kind == DecorationKind::Review => true,
@@ -3293,6 +3294,10 @@ mod tests { · 1538 unmodified lines
32933294 name: "detached".into(),
32943295 kind: DecorationKind::WorktreeDetached,
32953296 },
3297+ Decoration {
3298+ name: "current-detached".into(),
3299+ kind: DecorationKind::CurrentWorktreeDetached,
3300+ },
32963301 Decoration {
32973302 name: "HEAD".into(),
32983303 kind: DecorationKind::Head,
@@ -3305,6 +3310,10 @@ mod tests { · 6 unmodified lines
33053310 assert!(row.contains("@current"));
33063311 assert!(row.contains("main@"));
33073312 assert!(row.contains("detached@"));
3313+ assert!(
3314+ !row.contains("current-detached"),
3315+ "the graph @ already identifies the current detached worktree"
3316+ );
33083317 assert!(!row.contains("HEAD"), "a worktree label replaces textual HEAD");
33093318 let x = row.find("main@").expect("the worktree label is visible") as u16;
33103319 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