Skip to content

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

Fix dirty worktree detection to include untracked files

Maximilian Roosdccef45f5c7c
diff --git a/docs/content/claude-code.md b/docs/content/claude-code.md
index f40c2b1f4..3be77ac20 100644
--- a/docs/content/claude-code.md
+++ b/docs/content/claude-code.md
@@ -22,7 +22,7 @@ The plugin adds status indicators to `wt list`:
+ review-ui <span class=c>?</span> <span class=d>↑</span> πŸ’¬ <span class=g>↑1</span> ./repo.review-ui <span class=d>46b6a187</span> <span class=d>1d</span> <span class=d>Add dashboard component</span>
+ wip-docs <span class=c>?</span> <span class=d>–</span> ./repo.wip-docs <span class=d>a058e792</span> <span class=d>1d</span> <span class=d>Initial commit</span>
-βšͺ <span class=d>Showing 4 worktrees, 2 ahead</span>
+βšͺ <span class=d>Showing 4 worktrees, 2 with changes, 2 ahead</span>
{% end %}
<!-- END AUTO-GENERATED -->
diff --git a/src/commands/list/mod.rs b/src/commands/list/mod.rs
index 8219cf8a9..adaef524f 100644
--- a/src/commands/list/mod.rs
+++ b/src/commands/list/mod.rs
@@ -282,12 +282,14 @@ impl SummaryMetrics {
}
fn update(&mut self, item: &ListItem) {
- if let Some(data) = item.worktree_data() {
+ if let Some(_data) = item.worktree_data() {
self.worktrees += 1;
- if data
- .working_tree_diff
+ // Use status_symbols.working_tree which includes untracked files,
+ // not just working_tree_diff which only has tracked changes
+ if item
+ .status_symbols
.as_ref()
- .is_some_and(|d| !d.is_empty())
+ .is_some_and(|s| s.working_tree.is_dirty())
{
self.dirty_worktrees += 1;
}
diff --git a/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap b/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap
index 904861e50..c21a7d57f 100644
--- a/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap
+++ b/tests/snapshots/integration__integration_tests__list__large_diffs_alignment.snap
@@ -33,4 +33,4 @@ exit_code: 0
+ feature-changes !? ↑ πŸ€– +50 -100 ↑1 ./repo.feature-changes 38944dae 1d Add 100 lines
+ fix ? – πŸ’¬ ./repo.fix a1e809f5 1d Initial commit
-βšͺ Showing 4 worktrees, 2 with changes, 2 ahead
+βšͺ Showing 4 worktrees, 3 with changes, 2 ahead
diff --git a/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap b/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap
index 8f4f69b33..fbed30d41 100644
--- a/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap
+++ b/tests/snapshots/integration__integration_tests__list__task_dag_full_with_diffs.snap
@@ -34,4 +34,4 @@ exit_code: 0
+ feature-a ? – ./repo.feature-a a1e809f5 1d Initial commit
+ feature-b ↑ ↑1 +1 -1 ./repo.feature-b 86bdffd3 1d Test commit
-βšͺ Showing 3 worktrees, 1 ahead
+βšͺ Showing 3 worktrees, 1 with changes, 1 ahead
diff --git a/tests/snapshots/integration__integration_tests__list__with_user_marker.snap b/tests/snapshots/integration__integration_tests__list__with_user_marker.snap
index c8d56d02f..8facc028e 100644
--- a/tests/snapshots/integration__integration_tests__list__with_user_marker.snap
+++ b/tests/snapshots/integration__integration_tests__list__with_user_marker.snap
@@ -33,4 +33,4 @@ exit_code: 0
+ review-ui ? ↑ πŸ’¬ ↑1 ./repo.review-ui 46b6a187 1d Add dashboard component
+ wip-docs ? – ./repo.wip-docs a058e792 1d Initial commit
-βšͺ Showing 4 worktrees, 2 ahead
+βšͺ Showing 4 worktrees, 2 with changes, 2 ahead
diff --git a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap
index 85ecaa369..78c255cf8 100644
--- a/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap
+++ b/tests/snapshots/integration__integration_tests__list_column_alignment__status_column_width_consistency.snap
@@ -32,4 +32,4 @@ exit_code: 0
+ complex + ? ↑ +1 -1 ↑1 ./repo.complex 42162296 1d Complex
+ simple ? ↑ ↑1 ./repo.simple 63ee5cb5 1d Simple
-βšͺ Showing 3 worktrees, 1 with changes, 2 ahead
+βšͺ Showing 3 worktrees, 2 with changes, 2 ahead
diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap
index 771be0dcf..eb9d28575 100644
--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap
+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_extreme_diffs.snap
@@ -32,4 +32,4 @@ exit_code: 0
+ huge ? – ./repo.huge a1e809f5 1d Initial commit
+ tiny ! – +1 -1 ./repo.tiny a1e809f5 1d Initial commit
-βšͺ Showing 3 worktrees, 1 with changes
+βšͺ Showing 3 worktrees, 2 with changes
diff --git a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap
index e41f7c88a..424afb45a 100644
--- a/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap
+++ b/tests/snapshots/integration__integration_tests__spacing_edge_cases__alignment_varying_diffs.snap
@@ -33,4 +33,4 @@ exit_code: 0
+ feature-medium ? – ./repo.feature-medium a1e809f5 1d Initial commit
+ feature-small ? – ./repo.feature-small a1e809f5 1d Initial commit
-βšͺ Showing 4 worktrees
+βšͺ Showing 4 worktrees, 3 with changes