Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix: Display command path correctly in help output
Maximilian Roos0f3e3352bcbd
diff --git a/.claude-plugin/skills/worktrunk/reference/README.md b/.claude-plugin/skills/worktrunk/reference/README.mdindex 42e2ff397..90cc91800 100644--- a/.claude-plugin/skills/worktrunk/reference/README.md+++ b/.claude-plugin/skills/worktrunk/reference/README.md@@ -548,7 +548,7 @@ Options:Include branches without worktrees--remotes- Include remote branches from primary remote+ Include remote branches-v, --verboseShow git commands and debug infodiff --git a/README.md b/README.mdindex 42e2ff397..90cc91800 100644--- a/README.md+++ b/README.md@@ -548,7 +548,7 @@ Options:Include branches without worktrees--remotes- Include remote branches from primary remote+ Include remote branches-v, --verboseShow git commands and debug infodiff --git a/src/cli.rs b/src/cli.rsindex b86132ca4..d097919b3 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -491,7 +491,7 @@ Note: `locked` and `prunable` are top-level fields on worktree objects, not in s#[arg(long)]branches: bool,- /// Include primary remote branches+ /// Include remote branches#[arg(long)]remotes: bool,diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rsindex 43d238e41..e72cfcb4f 100644--- a/src/commands/list/collect.rs+++ b/src/commands/list/collect.rs@@ -427,7 +427,7 @@ fn get_branches_without_worktrees(Ok(branches_without_worktrees)}-/// Get remote branches from the primary remote that don't have local worktrees.+/// Get remote branches from all remotes that don't have local worktrees.////// Returns (branch_name, commit_sha) pairs for remote branches./// Filters out branches that already have worktrees (whether the worktree is on the@@ -436,13 +436,9 @@ fn get_remote_branches(repo: &Repository,worktrees: &[Worktree],) -> anyhow::Result<Vec<(String, String)>> {- // Get all remote branches from primary remote+ // Get all remote branches from all remoteslet all_remote_branches = repo.list_remote_branches()?;- // Get primary remote name for prefix stripping- let remote = repo.primary_remote()?;- let remote_prefix = format!("{}/", remote);-// Build a set of branch names that have worktreeslet worktree_branches: std::collections::HashSet<String> = worktrees.iter()@@ -453,13 +449,12 @@ fn get_remote_branches(let remote_branches: Vec<_> = all_remote_branches.into_iter().filter(|(remote_branch_name, _)| {- // Extract local branch name from "<remote>/feature" -> "feature"- // Only include branches that have the expected prefix format- if let Some(local_name) = remote_branch_name.strip_prefix(&remote_prefix) {+ // First '/' separates remote from branch: "origin/feature/foo" → "feature/foo"+ if let Some((_, local_name)) = remote_branch_name.split_once('/') {// Include remote branch if local branch doesn't have a worktree!worktree_branches.contains(local_name)} else {- // Skip branches that don't have the expected prefix (e.g., just "origin")+ // Skip branches without a remote prefixfalse}})diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rsindex dfe598df9..fe630058f 100644--- a/src/git/repository/mod.rs+++ b/src/git/repository/mod.rs@@ -601,22 +601,17 @@ impl Repository {Ok(branches)}- /// List remote branches from the primary remote, excluding HEAD.+ /// List remote branches from all remotes, excluding HEAD refs.////// Returns (branch_name, commit_sha) pairs for remote branches./// Branch names are in the form "origin/feature", not "feature".- /// Uses the primary remote (typically "origin", but respects upstream configuration).pub fn list_remote_branches(&self) -> anyhow::Result<Vec<(String, String)>> {- let remote = self.primary_remote()?;- let remote_ref_path = format!("refs/remotes/{}/", remote);-let output = self.run_command(&["for-each-ref","--format=%(refname:short) %(objectname)",- &remote_ref_path,+ "refs/remotes/",])?;- let remote_head = format!("{}/HEAD", remote);let branches: Vec<(String, String)> = output.lines().filter_map(|line| {@@ -624,10 +619,10 @@ impl Repository {if parts.len() == 2 {let branch_name = parts[0];// Skip <remote>/HEAD (symref)- if branch_name != remote_head {- Some((branch_name.to_string(), parts[1].to_string()))- } else {+ if branch_name.ends_with("/HEAD") {None+ } else {+ Some((branch_name.to_string(), parts[1].to_string()))}} else {Nonediff --git a/tests/snapshots/integration__integration_tests__help__help_list.snap b/tests/snapshots/integration__integration_tests__help__help_list.snapindex a327f3f03..4aba617f8 100644--- a/tests/snapshots/integration__integration_tests__help__help_list.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list.snap@@ -25,8 +25,8 @@ Options:--branchesInclude branches without worktrees- --remotes- Include primary remote branches+ --remotes+ Include remote branches--fullShow CI, conflicts, diffsdiff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snapindex 89f92419b..96bd0df32 100644--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap@@ -282,7 +282,7 @@ json\t'JSON output'"complete -c wt -n "__fish_wt_using_subcommand list" -s C -d 'Change working directory' -r -Fcomplete -c wt -n "__fish_wt_using_subcommand list" -l config -d 'User config file path' -r -Fcomplete -c wt -n "__fish_wt_using_subcommand list" -l branches -d 'Include branches without worktrees'-complete -c wt -n "__fish_wt_using_subcommand list" -l remotes -d 'Include primary remote branches'+complete -c wt -n "__fish_wt_using_subcommand list" -l remotes -d 'Include remote branches'complete -c wt -n "__fish_wt_using_subcommand list" -l full -d 'Show CI, conflicts, diffs'complete -c wt -n "__fish_wt_using_subcommand list" -l progressive -d 'Force progressive (or --no-progressive)'complete -c wt -n "__fish_wt_using_subcommand list" -l no-progressive -d 'Force buffered rendering'diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snapindex 69b1243f7..b7cb4ae18 100644--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap@@ -494,7 +494,7 @@ json\:"JSON output"))' \'-C+[Change working directory]:path:_files' \'--config=[User config file path]:path:_files' \'--branches[Include branches without worktrees]' \-'--remotes[Include primary remote branches]' \+'--remotes[Include remote branches]' \'--full[Show CI, conflicts, diffs]' \'--progressive[Force progressive (or --no-progressive)]' \'--no-progressive[Force buffered rendering]' \