Skip to content

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

Run merge-tree tasks for stale branches in picker (#2090)

Maximilian Roosdf84bd642f09
diff --git a/src/commands/list/collect/execution.rs b/src/commands/list/collect/execution.rs
index d681003bd..4c69e110f 100644
--- a/src/commands/list/collect/execution.rs
+++ b/src/commands/list/collect/execution.rs
@@ -39,12 +39,12 @@ use super::types::{TaskError, TaskKind, TaskResult};
// These are skipped for branches that are far behind the default branch (in `wt switch` interactive picker).
// AheadBehind is NOT here - we use batch data for it instead of skipping.
// CommittedTreesMatch is NOT here - it's a cheap tree comparison that aids integration detection.
+// WouldMergeAdd and MergeTreeConflicts are NOT here - they use the persistent SHA-keyed
+// probe cache, so they're instant on cache hits (only slow on the first invocation).
const EXPENSIVE_TASKS: &[TaskKind] = &[
- TaskKind::HasFileChanges, // git diff with three-dot range
- TaskKind::IsAncestor, // git merge-base --is-ancestor
- TaskKind::WouldMergeAdd, // git merge-tree simulation
- TaskKind::BranchDiff, // git diff with three-dot range
- TaskKind::MergeTreeConflicts, // git merge-tree simulation
+ TaskKind::HasFileChanges, // git diff with three-dot range
+ TaskKind::IsAncestor, // git merge-base --is-ancestor
+ TaskKind::BranchDiff, // git diff with three-dot range
];
/// Tasks that require a valid commit SHA. Skipped for unborn branches (no commits yet).
diff --git a/tests/snapshots/integration__integration_tests__list__list_skips_expensive_for_stale_branches_only.snap b/tests/snapshots/integration__integration_tests__list__list_skips_expensive_for_stale_branches_only.snap
index c5e4dca7e..9148591c9 100644
--- a/tests/snapshots/integration__integration_tests__list__list_skips_expensive_for_stale_branches_only.snap
+++ b/tests/snapshots/integration__integration_tests__list__list_skips_expensive_for_stale_branches_only.snap
@@ -49,7 +49,7 @@ exit_code: 0
+ feature-a ↕ ↑1 ↓2 ⋯ ../repo.feature-a 1b87d473 16h Add feature-a file
+ feature-b ↕ ↑1 ↓2 ⋯ ../repo.feature-b f62940fc 16h Add feature-b file
+ feature-c ↕ ↑1 ↓2 ⋯ ../repo.feature-c 345c7c93 16h Add feature-c file
- stale-branch /↓ ↓2 ⋯ 05a4a45d 16h Initial commit
+ stale-branch /⊂ ↓2 ⋯ 05a4a45d 16h Initial commit
○ Showing 4 worktrees, 1 branches, 3 ahead