Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Separate status into Git and user columns

Maximilian Roos494e87a41ff9
diff --git a/src/commands/list/columns.rs b/src/commands/list/columns.rs
index 8d2c25b3e..7466231f3 100644
--- a/src/commands/list/columns.rs
+++ b/src/commands/list/columns.rs
@@ -3,6 +3,7 @@
pub enum ColumnKind {
Branch,
Status,
+ UserStatus,
WorkingDiff,
AheadBehind,
BranchDiff,
@@ -71,75 +72,83 @@ pub const COLUMN_SPECS: &[ColumnSpec] = &[
1,
),
ColumnSpec::new(
- ColumnKind::WorkingDiff,
- super::layout::HEADER_WORKING_DIFF,
+ ColumnKind::UserStatus,
+ super::layout::HEADER_USER_STATUS,
3,
false,
false,
2,
),
ColumnSpec::new(
- ColumnKind::AheadBehind,
- super::layout::HEADER_AHEAD_BEHIND,
+ ColumnKind::WorkingDiff,
+ super::layout::HEADER_WORKING_DIFF,
4,
false,
false,
3,
),
+ ColumnSpec::new(
+ ColumnKind::AheadBehind,
+ super::layout::HEADER_AHEAD_BEHIND,
+ 5,
+ false,
+ false,
+ 4,
+ ),
ColumnSpec::new(
ColumnKind::BranchDiff,
super::layout::HEADER_BRANCH_DIFF,
- 5,
+ 6,
true,
false,
- 4,
+ 5,
),
ColumnSpec::new(
ColumnKind::Path,
super::layout::HEADER_PATH,
- 6,
+ 7,
false,
false,
- 5,
+ 6,
),
ColumnSpec::new(
ColumnKind::Upstream,
super::layout::HEADER_UPSTREAM,
- 7,
+ 8,
false,
false,
- 6,
+ 7,
),
ColumnSpec::new(
ColumnKind::CiStatus,
super::layout::HEADER_CI,
- 8,
+ 9,
false,
true,
- 7,
+ 8,
),
ColumnSpec::new(
ColumnKind::Commit,
super::layout::HEADER_COMMIT,
- 9,
+ 10,
false,
false,
- 8,
+ 9,
),
ColumnSpec::new(
ColumnKind::Time,
super::layout::HEADER_AGE,
- 10,
+ 11,
false,
false,
- 9,
+ 10,
),
ColumnSpec::new(
ColumnKind::Message,
super::layout::HEADER_MESSAGE,
- 11,
+ 12,
false,
false,
- 10,
+ 11,
),
];
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rs
index 2f676d1b1..fe166e929 100644
--- a/src/commands/list/layout.rs
+++ b/src/commands/list/layout.rs
@@ -129,6 +129,7 @@ const COMMIT_HASH_WIDTH: usize = 8;
/// Both layout calculations and rendering use these constants.
pub const HEADER_BRANCH: &str = "Branch";
pub const HEADER_STATUS: &str = "Status";
+pub const HEADER_USER_STATUS: &str = ""; // Empty header for user status column
pub const HEADER_WORKING_DIFF: &str = "HEAD±";
pub const HEADER_AHEAD_BEHIND: &str = "main↕";
pub const HEADER_BRANCH_DIFF: &str = "main…±";
@@ -216,6 +217,7 @@ pub struct DiffWidths {
pub struct ColumnWidths {
pub branch: usize,
pub status: usize,
+ pub user_status: usize,
pub time: usize,
pub ci_status: usize,
pub message: usize,
@@ -229,6 +231,7 @@ pub struct ColumnWidths {
#[derive(Clone, Copy, Debug)]
pub struct ColumnDataFlags {
pub status: bool,
+ pub user_status: bool,
pub working_diff: bool,
pub ahead_behind: bool,
pub branch_diff: bool,
@@ -242,6 +245,7 @@ fn column_has_data(kind: ColumnKind, flags: &ColumnDataFlags) -> bool {
match kind {
ColumnKind::Branch => true,
ColumnKind::Status => flags.status,
+ ColumnKind::UserStatus => flags.user_status,
ColumnKind::WorkingDiff => flags.working_diff,
ColumnKind::AheadBehind => flags.ahead_behind,
ColumnKind::BranchDiff => flags.branch_diff,
@@ -349,6 +353,7 @@ fn ideal_for_column(
match spec.kind {
ColumnKind::Branch => ColumnIdeal::text(widths.branch),
ColumnKind::Status => ColumnIdeal::text(widths.status),
+ ColumnKind::UserStatus => ColumnIdeal::text(widths.user_status),
ColumnKind::Path => ColumnIdeal::text(max_path_width),
ColumnKind::Time => ColumnIdeal::text(widths.time),
ColumnKind::CiStatus => ColumnIdeal::text(widths.ci_status),
@@ -368,6 +373,7 @@ pub fn calculate_column_widths(
// Track maximum data widths (headers are enforced via fit_header() later)
let mut max_branch = 0;
let mut max_status = 0;
+ let mut max_user_status = 0;
let mut max_time = 0;
let mut max_message = 0;
@@ -393,10 +399,19 @@ pub fn calculate_column_widths(
// Branch name
max_branch = max_branch.max(item.branch_name().width());
- // Status column: git status symbols + user-defined status (worktrees only)
+ // Status column: git status symbols (worktrees only)
+ // User status column: user-defined status (worktrees and branches)
if let Some(info) = worktree_info {
- let combined_width = info.combined_status().width();
- max_status = max_status.max(combined_width);
+ let git_status_width = info.status_symbols.render().width();
+ max_status = max_status.max(git_status_width);
+
+ if let Some(ref user_status) = info.user_status {
+ max_user_status = max_user_status.max(user_status.width());
+ }
+ } else if let ListItem::Branch(branch_info) = item
+ && let Some(ref user_status) = branch_info.user_status
+ {
+ max_user_status = max_user_status.max(user_status.width());
}
// Time
@@ -462,6 +477,9 @@ pub fn calculate_column_widths(
let has_status_data = max_status > 0;
let final_status = fit_header(HEADER_STATUS, max_status);
+ let has_user_status_data = max_user_status > 0;
+ let final_user_status = fit_header(HEADER_USER_STATUS, max_user_status);
+
// CI status column: Always 2 chars wide
// Only show if we attempted to fetch CI data (regardless of whether any items have status)
let has_ci_status = fetch_ci && items.iter().any(|item| item.pr_status().is_some());
@@ -470,6 +488,7 @@ pub fn calculate_column_widths(
let widths = ColumnWidths {
branch: fit_header(HEADER_BRANCH, max_branch),
status: final_status,
+ user_status: final_user_status,
time: fit_header(HEADER_AGE, max_time),
ci_status: fit_header(HEADER_CI, ci_status_width),
message: fit_header(HEADER_MESSAGE, max_message),
@@ -481,6 +500,7 @@ pub fn calculate_column_widths(
let data_flags = ColumnDataFlags {
status: has_status_data,
+ user_status: has_user_status_data,
working_diff: working_diff.added_digits > 0 || working_diff.deleted_digits > 0,
ahead_behind: ahead_behind.added_digits > 0 || ahead_behind.deleted_digits > 0,
branch_diff: branch_diff.added_digits > 0 || branch_diff.deleted_digits > 0,
diff --git a/src/commands/list/model.rs b/src/commands/list/model.rs
index 11d166136..df362becd 100644
--- a/src/commands/list/model.rs
+++ b/src/commands/list/model.rs
@@ -263,20 +263,6 @@ impl ListItem {
ListItem::Branch(info) => info.pr_status.as_ref(),
}
}
-
- /// Get combined status (git symbols + user status)
- /// For worktrees: uses WorktreeInfo.combined_status()
- /// For branches: returns user status (branches have no git status symbols)
- pub fn combined_status(&self) -> String {
- match self {
- ListItem::Worktree(info) => info.combined_status(),
- ListItem::Branch(info) => {
- // Branch-only entries show just the user status (no git symbols)
- // If no user status, show "·" to indicate "branch without worktree"
- info.user_status.clone().unwrap_or_else(|| "·".to_string())
- }
- }
- }
}
impl BranchInfo {
@@ -957,23 +943,6 @@ impl WorktreeInfo {
working_diff_display: None,
})
}
-
- /// Combine git status symbols and user-defined status
- /// Returns the combined string with aligned rendering
- pub fn combined_status(&self) -> String {
- if !self.status_symbols.is_empty() {
- let rendered = self.status_symbols.render();
- if let Some(ref user_status) = self.user_status {
- format!("{}{}", rendered, user_status)
- } else {
- rendered
- }
- } else if let Some(ref user_status) = self.user_status {
- user_status.clone()
- } else {
- String::new()
- }
- }
}
/// Gather list data (worktrees + optional branches).
diff --git a/src/commands/list/render.rs b/src/commands/list/render.rs
index 02963e4f4..bd8c23142 100644
--- a/src/commands/list/render.rs
+++ b/src/commands/list/render.rs
@@ -311,15 +311,39 @@ pub fn format_list_item_line(
}
}
(ColumnKind::Status, _) => {
- // Combine git status symbols + user-defined status from worktrunk.status
- let status_content = item.combined_status();
- let status_start = line.width();
+ // Git status symbols only (no user-defined status)
+ if let Some(info) = worktree_info {
+ let git_status = info.status_symbols.render();
+ let status_start = line.width();
+
+ // Status column never inherits row color
+ line.push_raw(git_status);
+
+ if !is_last {
+ line.pad_to(status_start + column.width);
+ }
+ } else if !is_last {
+ // Branch-only entries have no git status symbols
+ push_blank(&mut line, column.width);
+ }
+ }
+ (ColumnKind::UserStatus, _) => {
+ // User-defined status from worktrunk.status
+ let user_status_content = if let Some(info) = worktree_info {
+ info.user_status.clone().unwrap_or_default()
+ } else if let ListItem::Branch(branch_info) = item {
+ branch_info.user_status.clone().unwrap_or_default()
+ } else {
+ String::new()
+ };
+
+ let user_status_start = line.width();
- // Status column never inherits row color
- line.push_raw(status_content);
+ // UserStatus column never inherits row color
+ line.push_raw(user_status_content);
if !is_last {
- line.pad_to(status_start + column.width);
+ line.pad_to(user_status_start + column.width);
}
}
(ColumnKind::WorkingDiff, ColumnFormat::Diff { digits, variant }) => {
diff --git a/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap b/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap
index 0fc731ae9..2bdcc791e 100644
--- a/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap
+++ b/tests/snapshots/integration__integration_tests__list__branch_only_ignores_main_worktree_status.snap
@@ -16,14 +16,14 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmplee5sV/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpoJOgio/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-Branch Status HEAD± main↕ Path Remote↕ Commit Age Message
-main 🏠 . b834638e 10 months ago Initial commit
-branch-only 🌿 b834638e 10 months ago Initial commit
+Branch Status  HEAD± main↕ Path Remote↕ Commit Age Message
+main 🏠 . b834638e 10 months ago Initial commit
+branch-only 🌿 b834638e 10 months ago Initial commit
⚪ Showing 1 worktrees, 1 branches
diff --git a/tests/snapshots/integration__integration_tests__list__user_status_special_chars.snap b/tests/snapshots/integration__integration_tests__list__user_status_special_chars.snap
index d091a8723..64ce9b08a 100644
--- a/tests/snapshots/integration__integration_tests__list__user_status_special_chars.snap
+++ b/tests/snapshots/integration__integration_tests__list__user_status_special_chars.snap
@@ -15,15 +15,15 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5uHWVQ/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpz8bd4m/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-Branch Status HEAD± main↕ Path Remote↕ Commit Age Message
-main ./test-repo b834638e 10 months ago Initial commit
-emoji ≡🔄 ./emoji b834638e 10 months ago Initial commit
-multi ≡👨‍💻 ./multi b834638e 10 months ago Initial commit
+Branch Status  HEAD± main↕ Path Remote↕ Commit Age Message
+main ./test-repo b834638e 10 months ago Initial commit
+emoji ≡ 🔄 ./emoji b834638e 10 months ago Initial commit
+multi ≡ 👨‍💻 ./multi b834638e 10 months ago Initial commit
⚪ Showing 3 worktrees
diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap
index 1ebd553f4..2cc8f34a2 100644
--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap
+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0q3R8F/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp2zlR7z/test-config.toml
---
success: true
exit_code: 0
@@ -24,9 +24,9 @@ exit_code: 0
Branch Status HEAD± main↕ Path Remote↕ Commit Age Message
main ./test-repo b834638e 10 months ago Initial commit
feature-with-worktree ≡ ./feature-with-worktree b834638e 10 months ago Initial commit
-another-branch · b834638e 10 months ago Initial commit
-feature-without-worktree · b834638e 10 months ago Initial commit
-fix-bug · b834638e 10 months ago Initial commit
+another-branch b834638e 10 months ago Initial commit
+feature-without-worktree b834638e 10 months ago Initial commit
+fix-bug b834638e 10 months ago Initial commit
⚪ Showing 2 worktrees, 3 branches
diff --git a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap b/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap
index 98a918973..49fb88b94 100644
--- a/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap
+++ b/tests/snapshots/integration__integration_tests__list__with_branches_flag_only_branches.snap
@@ -16,16 +16,16 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpiGydZK/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpHJD6VJ/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
Branch Status HEAD± main↕ Path Remote↕ Commit Age Message
main . b834638e 10 months ago Initial commit
-branch-alpha · b834638e 10 months ago Initial commit
-branch-beta · b834638e 10 months ago Initial commit
-branch-gamma · b834638e 10 months ago Initial commit
+branch-alpha b834638e 10 months ago Initial commit
+branch-beta b834638e 10 months ago Initial commit
+branch-gamma b834638e 10 months ago Initial commit
⚪ Showing 1 worktrees, 3 branches
diff --git a/tests/snapshots/integration__integration_tests__list__with_user_status.snap b/tests/snapshots/integration__integration_tests__list__with_user_status.snap
index 3cba3d6e1..d41902ae6 100644
--- a/tests/snapshots/integration__integration_tests__list__with_user_status.snap
+++ b/tests/snapshots/integration__integration_tests__list__with_user_status.snap
@@ -15,17 +15,17 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfK8fKr/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpTwICoU/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
-Branch Status HEAD± main↕ Path Remote↕ Commit Age Message
-main ./test-repo b834638e 10 months ago Initial commit
-clean-no-status ≡ ./clean-no-status b834638e 10 months ago Initial commit
-clean-with-status ≡⏸️ ./clean-with-status b834638e 10 months ago Initial commit
-dirty-no-status ! +1 -1 ./dirty-no-status b834638e 10 months ago Initial commit
-dirty-with-status ≡ ?🤖 ./dirty-with-status b834638e 10 months ago Initial commit
+Branch Status  HEAD± main↕ Path Remote↕ Commit Age Message
+main ./test-repo b834638e 10 months ago Initial commit
+clean-no-status ≡ ./clean-no-status b834638e 10 months ago Initial commit
+clean-with-status ≡ ⏸️ ./clean-with-status b834638e 10 months ago Initial commit
+dirty-no-status ! +1 -1 ./dirty-no-status b834638e 10 months ago Initial commit
+dirty-with-status ≡ ? 🤖 ./dirty-with-status b834638e 10 months ago Initial commit
⚪ Showing 5 worktrees, 1 with changes