Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
docs: correct stale comments (list layout, repository caching spec, zsh probe trace) (#3540)
Worktrunk Bot72ae75124164
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rsindex 3b36d7580..d84ad371d 100644--- a/src/commands/list/layout.rs+++ b/src/commands/list/layout.rs@@ -160,7 +160,7 @@//! // Allocate columns in priority order, building pending list//! for candidate in candidates {//! if candidate.spec.kind == ColumnKind::Message {-//! // Special handling: flexible width (min 20, preferred 50)+//! // Special handling: flexible width (min 10, max 100)//! } else if let Some(ideal) = candidate.spec.kind.ideal(...) {//! if let allocated = try_allocate(&mut remaining, ideal.width, ...) {//! pending.push(PendingColumn { spec: candidate.spec, width: allocated, format: ideal.format });@@ -1048,7 +1048,7 @@ fn allocate_columns_with_priority(/// - Age: 4 chars ("11mo" short format)/// - CI: sized from `max_pr_number` (the cached largest PR/MR number seen,/// e.g. "#3035"); 5 chars ("#9999") before the first fetch populates it-/// - Message: flexible (20-100 chars)+/// - Message: flexible (10-100 chars)/// - URL: estimated from template + longest branchpub fn calculate_layout_with_width(items: &[super::model::ListItem],diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rsindex 5c53c3eef..815fa89bf 100644--- a/src/git/repository/mod.rs+++ b/src/git/repository/mod.rs@@ -25,10 +25,18 @@//! **Two layers, two scopes.** Cached state lives in either of://! - `RepoCache` — per-`Repository::at()` instance. Most repo-wide values//! (config, branches, worktree inventory) live here.-//! - Process-wide `LazyLock<DashMap>` statics — `GIT_COMMON_DIR_CACHE`,-//! `WORKTREE_ROOTS`, `GIT_DIRS`, `CURRENT_BRANCHES`. The git-discovery-//! data they hold is keyed by canonicalized filesystem path, so two-//! `Repository` instances pointed at the same path see the same answer.+//! - Process-wide statics that survive across `RepoCache` instances:+//! - `WORKTREE_ROOTS`, `GIT_DIRS`, `CURRENT_BRANCHES` (`LazyLock<DashMap>`),+//! keyed by canonicalized worktree path, so two `Repository` instances+//! pointed at the same path see the same answer.+//! - `GIT_COMMON_DIR_CACHE` and `GIT_CONFIG_PRELOAD` (`LazyLock<DashMap>`),+//! keyed by the *raw* discovery path passed to [`Repository::at`] /+//! [`Repository::prewarm`] — not canonicalized, since both the prewarm+//! producer and the `at()` consumer go through `base_path()` and share the+//! same `PathBuf`.+//! - `WORKTRUNK_USER_CONFIG_PRELOAD` (`OnceLock<UserConfig>`), process-scoped+//! rather than path-keyed (the config-path rule is process-invariant).+//!//! This lets [`Repository::prewarm`] populate the maps once at the start//! of `main` and have every later `Repository::current()` (each builds a//! fresh `RepoCache`) reuse the result.@@ -88,9 +96,15 @@//! (repo-wide `OnceCell` vs per-key `DashMap`) and their infallible/fallible variants.//!//! **Invariants:**-//! - A cached value, once written, is never updated within the same command.-//! - All cache access is lock-free at the call site — `OnceCell` and `DashMap` handle-//! synchronization internally.+//! - A cached value, once written, is never updated within the same command —+//! with one exception: the `all_config` map is an `OnceCell<RwLock<..>>` whose+//! *contents* stay coherent with in-process writes via+//! [`Repository::set_config_value`]. The `OnceCell` slot is still written+//! once; only the config values it holds can change.+//! - Cache access is lock-free at the call site for the `OnceCell`/`DashMap`+//! caches, which handle synchronization internally. The one exception is+//! `all_config`, whose `RwLock` callers lock explicitly (e.g. `config_last`)+//! so config writes stay visible to later reads.//! - Code that mutates repository state (committing, creating worktrees) must not read//! its own mutations through the cache. Use direct git commands for post-mutation//! state.diff --git a/src/shell/utils.rs b/src/shell/utils.rsindex 69e36980e..a62b93931 100644--- a/src/shell/utils.rs+++ b/src/shell/utils.rs@@ -346,7 +346,7 @@ pub fn detect_zsh_compinit() -> Option<bool> {let probe_cmd =r#"(( $+functions[compdef] )) && echo __WT_COMPINIT_YES__ || echo __WT_COMPINIT_NO__"#;- tracing::debug!(command = %probe_cmd, "$ zsh -ic '{}' (probe)", probe_cmd);+ tracing::debug!(command = %probe_cmd, "$ zsh +m -ic '{}' (probe)", probe_cmd);let mut cmd = Command::new("zsh");// `+m` disables job control so the interactive probe doesn't grab wt's