Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Report an empty listing in a bare repo instead of nothing (#3992)
Maximilian Roos3e86e5824be9
diff --git a/src/commands/list/collect/mod.rs b/src/commands/list/collect/mod.rsindex a6752d0b3..7964fc087 100644--- a/src/commands/list/collect/mod.rs+++ b/src/commands/list/collect/mod.rs@@ -317,8 +317,8 @@ use once_cell::sync::OnceCell;use rayon::prelude::*;use worktrunk::git::{ErrorExt, LocalBranch, Repository, WorktreeId, WorktreeInfo, WorktreeRef};use worktrunk::styling::{- INFO_SYMBOL, eprintln, format_with_gutter, hint_message, terminal_width, truncate_visible,- warning_message,+ INFO_SYMBOL, eprintln, format_with_gutter, hint_message, info_message, terminal_width,+ truncate_visible, warning_message,};use crate::commands::is_worktree_at_expected_path;@@ -564,8 +564,8 @@ pub trait PickerProgressHandler: Send + Sync {/// the injector while row tasks dominate worker deques.////// Not fired on the `WORKTRUNK_SKELETON_ONLY` / `WORKTRUNK_FIRST_OUTPUT`- /// benchmark early-exit, nor on the zero-worktree `Ok(None)` return- /// (which exits before `on_skeleton`). Default: no-op.+ /// benchmark early-exit, nor on the empty-listing return, which carries an+ /// empty `ListData` but exits before `on_skeleton`. Default: no-op.fn on_collect_complete(&self) {}/// Hand the picker a clone of the collect layout, right after `on_skeleton`.@@ -878,11 +878,13 @@ pub fn collect(});});- // Extract results+ // Extract results.+ //+ // The worktree list is empty for a bare repo with no linked worktrees. That+ // is not a reason to stop: `--branches` still has rows to list there, and a+ // listing with no rows at all owes the user a message rather than a silent+ // exit (see the `all_items.is_empty()` gate below).let worktrees: &[WorktreeInfo] = repo.list_worktrees().context("Failed to list worktrees")?;- if worktrees.is_empty() {- return Ok(None);- }// Both cells are unconditionally `set()` inside the rayon scope above, so// `into_inner()` is always `Some`. Use `.flatten()` rather than `.unwrap()`// to honor the no-unwrap rule and match the sibling cells below.@@ -965,11 +967,23 @@ pub fn collect(} else {None};- let warn_stale_default = needs_stale_check+ // Two questions, deliberately separate. Whether the persisted default+ // resolves decides what downstream tasks may resolve against; whether to+ // say so decides only what the user reads.+ let default_branch_missing = needs_stale_check&& fetched_local.is_some_and(|all| {!all.iter().any(|b| Some(b.name.as_str()) == default_branch.as_deref())});+ // An empty inventory is a repo with no commits yet, not a branch someone+ // deleted. `infer_default_branch_locally` resolves `symbolic-ref HEAD`,+ // which names `main` in a fresh `git init --bare -b main` before+ // `refs/heads/main` exists, so warning here would report a branch that was+ // never created as externally deleted — and the hint's remedy loops,+ // because clearing the persisted value only lets the next run re-infer it.+ // Only the message is suppressed: the value is still dropped below.+ let warn_stale_default =+ default_branch_missing && fetched_local.is_some_and(|all| !all.is_empty());// Filter local branches to those without worktrees (CPU-only, no git// commands). With `show_branches` off there are no branch-only rows.@@ -996,12 +1010,15 @@ pub fn collect();}- // When the persisted default is stale, drop it for downstream tasks.- // Tasks that resolve against it (ahead-behind, merge-tree-conflicts,- // etc.) would otherwise emit a cascade of "ambiguous argument" errors;- // passing `None` here preserves the old None-returns silent-skip- // behavior that callers already handle for repos with no default branch.- let default_branch = if warn_stale_default {+ // When the persisted default doesn't resolve, drop it for downstream+ // tasks. Tasks that resolve against it (ahead-behind,+ // merge-tree-conflicts, etc.) would otherwise emit a cascade of "ambiguous+ // argument" errors; passing `None` here preserves the old None-returns+ // silent-skip behavior that callers already handle for repos with no+ // default branch. This follows the missing value, not the warning: a repo+ // with no branches at all raises no message and still must not resolve+ // against a branch that isn't there.+ let default_branch = if default_branch_missing {None} else {default_branch@@ -1036,18 +1053,27 @@ pub fn collect(// Main worktree is the primary worktree (for sorting and is_main display).// - Normal repos: the main worktree (repo root)// - Bare repos: the default branch's worktree+ //+ // `None` when no worktree can be the main one — a bare repo with no linked+ // worktrees, and the degenerate case where every registration is prunable.+ // Rows can still exist there (branch-only rows under `--branches`), so this+ // is a normal answer rather than an error: no row is flagged main, and path+ // shortening falls back to the repo root, which no row uses because a+ // branch-only row has no path.let primary_id = repo.primary_worktree()?.as_ref().map(WorktreeId::new);- let (main_worktree, main_worktree_id) = {- let (wt, worktree_ref) = primary_id+ let (main_worktree_path, main_worktree_id) = {+ let main = primary_id.as_ref().and_then(|id| {worktree_subjects.iter().find(|(_, worktree_ref)| worktree_ref.id() == id)})- .or_else(|| worktree_subjects.iter().find(|(wt, _)| !wt.is_prunable()))- .ok_or_else(|| anyhow::anyhow!("No worktrees found"))?;- (*wt, worktree_ref.id().clone())+ .or_else(|| worktree_subjects.iter().find(|(wt, _)| !wt.is_prunable()));+ match main {+ Some((wt, worktree_ref)) => (wt.path.clone(), Some(worktree_ref.id().clone())),+ None => (repo.repo_path()?.to_path_buf(), None),+ }};// Defer previous_branch lookup until after skeleton - set is_previous later@@ -1086,7 +1112,7 @@ pub fn collect(// Sort worktrees: current first, main second, then by timestamp descendinglet sorted_worktrees = sort_worktrees_with_cache(worktree_subjects,- &main_worktree_id,+ main_worktree_id.as_ref(),current_worktree_id.as_ref(),&commit_details_map,);@@ -1112,7 +1138,7 @@ pub fn collect(let mut all_items: Vec<ListItem> = sorted_worktrees.iter().map(|(wt, worktree_ref)| {- let is_main = worktree_ref.id() == &main_worktree_id;+ let is_main = main_worktree_id.as_ref() == Some(worktree_ref.id());let is_current = current_worktree_id.as_ref() == Some(worktree_ref.id());// is_previous set to false initially - computed after skeletonlet is_previous = false;@@ -1276,6 +1302,45 @@ pub fn collect(full_plan()};+ // Which gated fact families the plan requested — recorded on `ListData`+ // so JSON output can distinguish "not requested" from "undetermined".+ let collected = super::model::Collected {+ ci: tasks.contains(&TaskKind::CiStatus),+ summary: tasks.contains(&TaskKind::SummaryGenerate),+ };++ // Nothing to list. Only a bare repo with no linked worktrees reaches this —+ // any other shape has at least a main worktree — and then only when no+ // branch rows were requested or none survived filtering. There is no table+ // to render (a lone header would be noise, and stdout must stay empty for+ // `wt list | …`), so the state goes to stderr and the collection phases+ // below are skipped entirely.+ //+ // `--format json` still owes its consumer a payload, so the empty+ // `ListData` returns either way; the caller prints `[]` or an envelope with+ // `items: []`. The narration is table-only: JSON says the same thing on+ // stdout, and the picker owns the terminal while collect runs.+ if all_items.is_empty() {+ if render_table {+ eprintln!("{}", info_message("No worktrees"));+ // A `git clone --bare` reaches this with its branches intact, and+ // `--create` on one of those errors; point at what the repo has.+ let hint = if repo.local_branches()?.is_empty() {+ cformat!("To create a worktree, run <underline>wt switch --create <<branch>></>")+ } else {+ cformat!(+ "To see the branches, run <underline>wt list --branches</>; to check one out, run <underline>wt switch <<branch>></>"+ )+ };+ eprintln!("{}", hint_message(hint));+ }+ return Ok(Some(super::model::ListData {+ items: Vec::new(),+ custom_columns,+ collected,+ }));+ }+// The picker primes its CI cells from the local cache so the column paints// instantly, then the live `CiStatus` task (which the picker keeps — see// `handle_picker`) overwrites each cell as results stream in. Uncached rows@@ -1310,7 +1375,7 @@ pub fn collect(&all_items,&tasks,destination,- &main_worktree.path,+ &main_worktree_path,url_template.as_deref(),max_pr_number,super::layout::ColumnSelection {@@ -1323,13 +1388,6 @@ pub fn collect(// keeps rows untruncated rather than wrapping at a guessed widthlet max_width = terminal_width().unwrap_or(usize::MAX);- // Which gated fact families the plan requested — recorded on `ListData`- // so JSON output can distinguish "not requested" from "undetermined".- let collected = super::model::Collected {- ci: tasks.contains(&TaskKind::CiStatus),- summary: tasks.contains(&TaskKind::SummaryGenerate),- };-// Create collection options from the planned task set. `integration_targets`// is patched in after the parallel phase below extracts it — at this// point we haven't yet resolved it, but task spawning doesn't happen@@ -2067,16 +2125,19 @@ where/// Sort worktrees: current first, main second, then by timestamp descending./// Uses the pre-fetched commit-details map for efficiency.+///+/// `main_worktree_id` is `None` when the repo has no main worktree (a bare repo+/// with no linked worktrees); the middle tier is then simply empty.fn sort_worktrees_with_cache<'a>(mut worktrees: Vec<(&'a WorktreeInfo, WorktreeRef)>,- main_worktree_id: &WorktreeId,+ main_worktree_id: Option<&WorktreeId>,current_worktree_id: Option<&WorktreeId>,commit_details: &std::collections::HashMap<String, (String, i64, String)>,) -> Vec<(&'a WorktreeInfo, WorktreeRef)> {worktrees.sort_by_key(|(wt, worktree_ref)| {let priority = if current_worktree_id == Some(worktree_ref.id()) {0 // Current first- } else if worktree_ref.id() == main_worktree_id {+ } else if main_worktree_id == Some(worktree_ref.id()) {1 // Main second} else {2 // Rest by timestampdiff --git a/tests/integration_tests/bare_repository.rs b/tests/integration_tests/bare_repository.rsindex d45d4b378..1a866997b 100644--- a/tests/integration_tests/bare_repository.rs+++ b/tests/integration_tests/bare_repository.rs@@ -54,6 +54,103 @@ fn test_bare_repo_list_shows_no_bare_entry() {});}+/// A bare repo carrying branches but no worktrees — the shape `git clone+/// --bare` leaves, and the only shape where `git worktree list` reports+/// nothing once the bare entry is filtered out.+fn bare_repo_without_worktrees() -> BareRepoTest {+ let test = BareRepoTest::new();++ let main_worktree = test.create_worktree("main", "main");+ test.commit_in(&main_worktree, "Initial commit");+ test.create_worktree("feature", "feature");++ // Detach both branches from their worktrees: `main` and `feature` remain in+ // the bare repo, and nothing is registered as a worktree.+ test.run_git_in(test.bare_repo_path(), &["worktree", "remove", "feature"]);+ test.run_git_in(test.bare_repo_path(), &["worktree", "remove", "main"]);++ test+}++/// `wt list` in a bare repo with no worktrees exits 0 and names the state on+/// stderr: the `○ No worktrees` line and the hint under it. Stdout stays+/// empty because the table has no rows and a lone header would be noise to+/// anything piping it.+#[test]+fn test_bare_repo_list_no_worktrees() {+ let test = bare_repo_without_worktrees();++ let settings = setup_temp_snapshot_settings(test.temp_path());+ settings.bind(|| {+ let mut cmd = wt_command();+ test.configure_wt_cmd(&mut cmd);+ cmd.arg("list").current_dir(test.bare_repo_path());++ assert_cmd_snapshot!(cmd);+ });+}++/// `--format json` owes its consumer a payload in the same state: the schema-2+/// envelope with `items: []`, not an empty stdout that no parser accepts.+#[test]+fn test_bare_repo_list_no_worktrees_json() {+ let test = bare_repo_without_worktrees();+ fs::write(+ test.config_path(),+ "worktree-path = \"{{ branch }}\"\n\n[list]\njson-schema = 2\n",+ )+ .unwrap();++ let settings = setup_temp_snapshot_settings(test.temp_path());+ settings.bind(|| {+ let mut cmd = wt_command();+ test.configure_wt_cmd(&mut cmd);+ cmd.args(["list", "--format", "json"])+ .current_dir(test.bare_repo_path());++ assert_cmd_snapshot!(cmd);+ });+}++/// The branches are still listable with no worktree to anchor them: `wt list+/// --branches` renders its rows, and the empty-worktree message stays out of+/// the way because the listing isn't empty.+#[test]+fn test_bare_repo_list_no_worktrees_branches() {+ let test = bare_repo_without_worktrees();++ let settings = setup_temp_snapshot_settings(test.temp_path());+ settings.bind(|| {+ let mut cmd = wt_command();+ test.configure_wt_cmd(&mut cmd);+ cmd.args(["list", "--branches"])+ .current_dir(test.bare_repo_path());++ assert_cmd_snapshot!(cmd);+ });+}++/// A bare repo with no commits at all — `git init --bare -b main`, before+/// anything is pushed to it. The empty listing is the whole output: nothing+/// was deleted here, so the stale-default-branch warning must stay silent even+/// though `refs/heads/main` doesn't exist. `infer_default_branch_locally`+/// resolves `symbolic-ref HEAD`, which names `main` regardless, and warning+/// would send the user to `wt config state default-branch clear` — a remedy+/// that loops, because the next run re-infers the same value from `HEAD`.+#[test]+fn test_bare_repo_list_no_commits() {+ let test = BareRepoTest::new();++ let settings = setup_temp_snapshot_settings(test.temp_path());+ settings.bind(|| {+ let mut cmd = wt_command();+ test.configure_wt_cmd(&mut cmd);+ cmd.arg("list").current_dir(test.bare_repo_path());++ assert_cmd_snapshot!(cmd);+ });+}+#[test]fn test_bare_repo_switch_creates_worktree() {let test = BareRepoTest::new();diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rsindex f43b2401d..00beff117 100644--- a/tests/integration_tests/list.rs+++ b/tests/integration_tests/list.rs@@ -3870,6 +3870,46 @@ fn test_list_branches_with_nonexistent_default_branch(repo: TestRepo) {});}+/// A repo whose branch inventory is empty still drops an unresolvable default+/// branch, even though it raises no warning about it.+///+/// The two are separate decisions. `wt list` stays quiet here because an empty+/// inventory is as likely to be a repo with no commits — nothing was deleted,+/// and `wt config state default-branch clear` would only be re-inferred on the+/// next run. But the persisted value still names no branch, so the tasks that+/// resolve against it (ahead/behind, branch diff, merge-conflict check) must+/// not be handed it: each would fail with `fatal: Needed a single revision`,+/// and the run would end in a "3 tasks failed" block.+///+/// Detaching HEAD and deleting the only branch is the shape that reaches this+/// with a row still on the table; the bare-no-commits repo has no rows, so+/// nothing downstream fires there.+#[rstest]+fn test_list_detached_with_no_branches_drops_stale_default() {+ let repo = TestRepo::with_initial_commit();+ repo.run_git(&["config", "worktrunk.default-branch", "main"]);+ repo.run_git(&["checkout", "--detach"]);+ repo.run_git(&["branch", "-D", "main"]);++ let output = list_snapshots::command(&repo, repo.root_path())+ .output()+ .unwrap();+ let stderr = String::from_utf8_lossy(&output.stderr);++ assert!(+ output.status.success(),+ "wt list should succeed; stderr: {stderr}"+ );+ assert!(+ !stderr.contains("tasks failed"),+ "the dropped default must keep every task off the missing branch; got: {stderr:?}"+ );+ assert!(+ !stderr.contains("does not exist locally"),+ "an empty branch inventory reports nothing; got: {stderr:?}"+ );+}+/// Tests that the current worktree indicator (@) is correct for nested worktrees.////// When worktrees are placed inside other worktrees (e.g., `.worktrees/` layout),diff --git a/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_commits.snap b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_commits.snapnew file mode 100644index 000000000..528cbb62a--- /dev/null+++ b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_commits.snap@@ -0,0 +1,53 @@+---+source: tests/integration_tests/bare_repository.rs+info:+ program: wt+ args:+ - list+ env:+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ TERM: alacritty+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+○ No worktrees+↳ To create a worktree, run wt switch --create <branch>diff --git a/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees.snap b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees.snapnew file mode 100644index 000000000..2e259ddf9--- /dev/null+++ b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees.snap@@ -0,0 +1,53 @@+---+source: tests/integration_tests/bare_repository.rs+info:+ program: wt+ args:+ - list+ env:+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ TERM: alacritty+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+○ No worktrees+↳ To see the branches, run wt list --branches; to check one out, run wt switch <branch>diff --git a/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees_branches.snap b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees_branches.snapnew file mode 100644index 000000000..9933d59e1--- /dev/null+++ b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees_branches.snap@@ -0,0 +1,57 @@+---+source: tests/integration_tests/bare_repository.rs+info:+ program: wt+ args:+ - list+ - "--branches"+ env:+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ TERM: alacritty+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+---+success: true+exit_code: 0+----- stdout -----+ Branch Status HEAD± main↕ main…± Remote⇅ Path Commit Age Message+/ feature /_ b834638 1d Initial commit+/ main /_ b834638 1d Initial commit++----- stderr -----++○ Showing 0 worktrees, 2 branchesdiff --git a/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees_json.snap b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees_json.snapnew file mode 100644index 000000000..60864d883--- /dev/null+++ b/tests/snapshots/integration__integration_tests__bare_repository__bare_repo_list_no_worktrees_json.snap@@ -0,0 +1,64 @@+---+source: tests/integration_tests/bare_repository.rs+info:+ program: wt+ args:+ - list+ - "--format"+ - json+ env:+ COLUMNS: "500"+ GIT_ALLOW_PROTOCOL: file+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_AUTHOR_EMAIL: [email protected]+ GIT_AUTHOR_NAME: Test User+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_EMAIL: [email protected]+ GIT_COMMITTER_NAME: Test User+ GIT_CONFIG_COUNT: "2"+ GIT_CONFIG_GLOBAL: /nonexistent/wt/gitconfig+ GIT_CONFIG_KEY_0: user.useConfigOnly+ GIT_CONFIG_KEY_1: rerere.enabled+ GIT_CONFIG_SYSTEM: /nonexistent/wt/gitconfig+ GIT_CONFIG_VALUE_0: "true"+ GIT_CONFIG_VALUE_1: "false"+ GIT_TERMINAL_PROMPT: "0"+ LANG: C+ LC_ALL: C+ LLVM_PROFILE_FILE: "[LLVM_PROFILE_FILE]"+ TERM: alacritty+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_BASH_INSTALLED: "0"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_CODEX_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_FISH_INSTALLED: "0"+ WORKTRUNK_TEST_GEMINI_INSTALLED: "0"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_PARENT_SHELL: ""+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"+ WORKTRUNK_TEST_PROBE_TIMEOUT_MS: "60000"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"+---+success: true+exit_code: 0+----- stdout -----+{+ "schema": 2,+ "repo": {+ "default_branch": "main"+ },+ "collected": {+ "ci": false,+ "summary": false+ },+ "items": []+}++----- stderr -----