Skip to content

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

Validate before approval in switch and remove commands (#582)

Maximilian Roosdd61e77fb3f7
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index d35f86e74..a20ae7074 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -42,8 +42,8 @@ pub(crate) use step_commands::{
step_show_squash_prompt,
};
pub(crate) use worktree::{
- ResolutionContext, compute_worktree_path, handle_remove, handle_remove_current, handle_switch,
- is_worktree_at_expected_path, resolve_worktree_arg, worktree_display_name,
+ ResolutionContext, execute_switch, handle_remove, handle_remove_current,
+ is_worktree_at_expected_path, plan_switch, resolve_worktree_arg, worktree_display_name,
};
// Re-export Shell from the canonical location
diff --git a/src/commands/select.rs b/src/commands/select.rs
index 545453744..437534fad 100644
--- a/src/commands/select.rs
+++ b/src/commands/select.rs
@@ -16,7 +16,7 @@ use worktrunk::shell_exec::Cmd;
use super::list::collect;
use super::list::layout::{DiffDisplayConfig, DiffVariant};
use super::list::model::ListItem;
-use super::worktree::handle_switch;
+use super::worktree::{execute_switch, plan_switch};
use crate::output::handle_switch_output;
use crate::pager::{git_config_pager, parse_pager_value};
@@ -1178,11 +1178,11 @@ pub fn handle_select(
// Load config
let config = WorktrunkConfig::load().context("Failed to load config")?;
+ let repo = Repository::current().context("Failed to switch worktree")?;
- // Switch to the selected worktree
- // handle_switch can handle both branch names and worktree paths
- let (result, branch_info) =
- handle_switch(&identifier, false, None, false, false, false, &config)?;
+ // Switch to the selected worktree (no creation, no approval prompts)
+ let plan = plan_switch(&repo, &identifier, false, None, false, &config)?;
+ let (result, branch_info) = execute_switch(&repo, plan, &config, false, true)?;
// Clear the terminal screen after skim exits to prevent artifacts
// Use stderr for terminal control - stdout is reserved for data output
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 4c6b80834..d0029e429 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -82,7 +82,7 @@ use anyhow::Context;
use color_print::cformat;
use dunce::canonicalize;
use normalize_path::NormalizePath;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use worktrunk::HookType;
use worktrunk::config::WorktrunkConfig;
use worktrunk::git::{GitError, Repository, ResolvedWorktree};
@@ -99,21 +99,24 @@ use super::repository_ext::{RemoveTarget, RepositoryCliExt};
///
/// For paths with extensions: `file.txt` → `file.txt.bak.TIMESTAMP`
/// For paths without extensions: `foo` → `foo.bak.TIMESTAMP`
-fn generate_backup_path(path: &std::path::Path, suffix: &str) -> PathBuf {
+///
+/// Returns an error for unusual paths without a file name (e.g., `/` or `..`).
+fn generate_backup_path(path: &std::path::Path, suffix: &str) -> anyhow::Result<PathBuf> {
+ let file_name = path
+ .file_name()
+ .ok_or_else(|| anyhow::anyhow!("Cannot generate backup path for {}", path.display()))?;
+
if path.extension().is_none() {
// Path has no extension (e.g., /repo/feature)
- path.with_file_name(format!(
- "{}.bak.{suffix}",
- path.file_name().unwrap().to_string_lossy()
- ))
+ Ok(path.with_file_name(format!("{}.bak.{suffix}", file_name.to_string_lossy())))
} else {
// Path has an extension (e.g., /repo.feature or /file.txt)
- path.with_extension(format!(
+ Ok(path.with_extension(format!(
"{}.bak.{suffix}",
path.extension()
.map(|e| e.to_string_lossy().to_string())
.unwrap_or_default()
- ))
+ )))
}
}
@@ -345,6 +348,60 @@ pub struct SwitchBranchInfo {
pub expected_path: Option<PathBuf>,
}
+/// Validated plan for a switch operation.
+///
+/// Created by `plan_switch()`, consumed by `execute_switch()`.
+/// This separation allows validation to happen before approval prompts,
+/// ensuring users aren't asked to approve hooks for operations that will fail.
+#[derive(Debug)]
+pub enum SwitchPlan {
+ /// Branch already has a worktree - just switch to it (no git commands needed)
+ Existing {
+ path: PathBuf,
+ branch: String,
+ /// Expected path for mismatch detection
+ expected_path: PathBuf,
+ /// Branch to record as "previous" for `wt switch -`
+ new_previous: Option<String>,
+ },
+ /// Need to create a new worktree
+ Create {
+ branch: String,
+ worktree_path: PathBuf,
+ /// True if using `-b` to create a new branch (--create flag)
+ create_branch: bool,
+ /// Base branch for creation (resolved, validated to exist)
+ base_branch: Option<String>,
+ /// If path exists and --clobber, this is the backup path to move it to
+ clobber_backup: Option<PathBuf>,
+ /// Branch to record as "previous" for `wt switch -`
+ new_previous: Option<String>,
+ },
+}
+
+impl SwitchPlan {
+ /// Get the worktree path for this plan.
+ pub fn worktree_path(&self) -> &Path {
+ match self {
+ SwitchPlan::Existing { path, .. } => path,
+ SwitchPlan::Create { worktree_path, .. } => worktree_path,
+ }
+ }
+
+ /// Get the branch name for this plan.
+ pub fn branch(&self) -> &str {
+ match self {
+ SwitchPlan::Existing { branch, .. } => branch,
+ SwitchPlan::Create { branch, .. } => branch,
+ }
+ }
+
+ /// Returns true if this plan will create a new worktree.
+ pub fn is_create(&self) -> bool {
+ matches!(self, SwitchPlan::Create { .. })
+ }
+}
+
/// How the branch should be handled after worktree removal.
///
/// This enum replaces the previous `no_delete_branch: bool, force_delete: bool` pattern,
@@ -413,29 +470,31 @@ pub enum RemoveResult {
},
}
-pub fn handle_switch(
+/// Validate and plan a switch operation.
+///
+/// This performs all validation upfront, returning a `SwitchPlan` that can be
+/// executed later. Call this BEFORE approval prompts to ensure users aren't
+/// asked to approve hooks for operations that will fail.
+///
+/// Warnings (remote branch shadow, --base without --create, invalid default branch)
+/// are printed during planning since they're informational, not blocking.
+pub fn plan_switch(
+ repo: &Repository,
branch: &str,
create: bool,
base: Option<&str>,
- force: bool,
clobber: bool,
- no_verify: bool,
config: &WorktrunkConfig,
-) -> anyhow::Result<(SwitchResult, SwitchBranchInfo)> {
- let repo = Repository::current()?;
-
+) -> anyhow::Result<SwitchPlan> {
// Get the actual current branch BEFORE switching.
// This is what we'll record as "previous" in history for `wt switch -` support.
- let actual_current_branch = repo.current_worktree().branch().ok().flatten();
+ let new_previous = repo.current_worktree().branch().ok().flatten();
// Resolve special branch names ("@" for current, "-" for previous)
let resolved_branch = repo
.resolve_worktree_name(branch)
.context("Failed to resolve branch name")?;
- // Record actual current branch as new "previous" for ping-pong behavior
- let new_previous = actual_current_branch;
-
// Resolve base if provided
let resolved_base = if let Some(base_str) = base {
Some(repo.resolve_worktree_name(base_str)?)
@@ -475,43 +534,17 @@ pub fn handle_switch(
}
// Compute expected worktree path for this branch
- let expected_path = compute_worktree_path(&repo, &resolved_branch, config)?;
-
- // Helper to build switch result for an existing worktree.
- let switch_to_existing = |path: PathBuf| -> (SwitchResult, SwitchBranchInfo) {
- let canonical_path = canonicalize(&path).unwrap_or(path.clone());
- let current_dir = std::env::current_dir()
- .ok()
- .and_then(|p| canonicalize(&p).ok());
- let already_at_worktree = current_dir
- .as_ref()
- .map(|cur| cur == &canonical_path)
- .unwrap_or(false);
-
- // Check if the actual path matches the expected path (branch-worktree mismatch detection).
- let mismatch_path = if !paths_match(&path, &expected_path) {
- Some(expected_path.clone())
- } else {
- None
- };
-
- let result = if already_at_worktree {
- SwitchResult::AlreadyAt(canonical_path)
- } else {
- SwitchResult::Existing(canonical_path)
- };
- let branch_info = SwitchBranchInfo {
- branch: resolved_branch.clone(),
- expected_path: mismatch_path,
- };
- (result, branch_info)
- };
+ let expected_path = compute_worktree_path(repo, &resolved_branch, config)?;
// Branch-first lookup: check if branch has a worktree anywhere
match repo.worktree_for_branch(&resolved_branch)? {
Some(existing_path) if existing_path.exists() => {
- let _ = repo.record_switch_previous(new_previous.as_deref());
- return Ok(switch_to_existing(existing_path));
+ return Ok(SwitchPlan::Existing {
+ path: canonicalize(&existing_path).unwrap_or(existing_path),
+ branch: resolved_branch,
+ expected_path,
+ new_previous,
+ });
}
Some(_) => {
return Err(GitError::WorktreeMissing {
@@ -523,10 +556,6 @@ pub fn handle_switch(
}
// No worktree for branch - validate branch exists before proceeding
- // When not creating, the branch must exist (locally or on remote)
- // Note: This check could be moved to the error recovery path (after git worktree add
- // fails) to avoid the ~10ms overhead on the happy path. We'd detect "invalid reference"
- // in the error, then call branch_exists() to determine which branch is invalid.
if !create && !repo.branch_exists(&resolved_branch)? {
return Err(GitError::InvalidReference {
reference: resolved_branch.clone(),
@@ -534,15 +563,12 @@ pub fn handle_switch(
.into());
}
- // No worktree for branch - check if expected path is occupied by a different branch's worktree
+ // Check if expected path is occupied by a different branch's worktree
if let Some((existing_path, path_branch)) = repo.worktree_at_path(&expected_path)? {
if !existing_path.exists() {
- // Stale worktree metadata - git thinks there's a worktree but directory is gone
let branch = path_branch.unwrap_or_else(|| resolved_branch.clone());
return Err(GitError::WorktreeMissing { branch }.into());
}
-
- // Path is occupied by a different branch's worktree
return Err(GitError::WorktreePathOccupied {
branch: resolved_branch.clone(),
path: expected_path,
@@ -551,55 +577,35 @@ pub fn handle_switch(
.into());
}
- // No existing worktree for branch or at expected path - will create one
- let worktree_path = expected_path;
-
- // If the target path already exists but is NOT a worktree (e.g., stale directory),
- // either move it to .bak (with --clobber) or surface a helpful error.
- if worktree_path.exists() {
+ // Determine clobber backup path if needed
+ let clobber_backup = if expected_path.exists() {
if clobber {
- use anyhow::Context;
-
- // Generate timestamped backup path
let timestamp = worktrunk::utils::get_now() as i64;
let datetime =
chrono::DateTime::from_timestamp(timestamp, 0).unwrap_or_else(chrono::Utc::now);
let suffix = datetime.format("%Y%m%d-%H%M%S").to_string();
- let backup_path = generate_backup_path(&worktree_path, &suffix);
+ let backup_path = generate_backup_path(&expected_path, &suffix)?;
- // Error if backup path already exists
if backup_path.exists() {
anyhow::bail!(
"Backup path already exists: {}",
worktrunk::path::format_path_for_display(&backup_path)
);
}
-
- let path_display = worktrunk::path::format_path_for_display(&worktree_path);
- let backup_display = worktrunk::path::format_path_for_display(&backup_path);
- crate::output::print(warning_message(cformat!(
- "Moving <bold>{path_display}</> to <bold>{backup_display}</> (--clobber)"
- )))?;
-
- std::fs::rename(&worktree_path, &backup_path)
- .with_context(|| format!("Failed to move {path_display} to {backup_display}"))?;
+ Some(backup_path)
} else {
return Err(GitError::WorktreePathExists {
branch: resolved_branch.clone(),
- path: worktree_path,
+ path: expected_path,
create,
}
.into());
}
- }
-
- // Create the worktree
- // Build git worktree add command
- let worktree_path_str = worktree_path.to_string_lossy();
- let mut args = vec!["worktree", "add", worktree_path_str.as_ref()];
+ } else {
+ None
+ };
- // Check for invalid configured default branch when creating without explicit --base.
- // Show warning if user's configured default branch doesn't exist locally.
+ // Check for invalid configured default branch when creating without explicit --base
if create
&& resolved_base.is_none()
&& let Some(configured) = repo.invalid_default_branch_config()
@@ -612,13 +618,10 @@ pub fn handle_switch(
)))?;
}
- // Use the resolved base, or default to default branch if creating without a base.
- // For bare repos with no branches yet (bootstrap case), allow None to create orphan branch.
- let base_for_creation = if create {
+ // Resolve base branch for creation
+ let base_branch = if create {
match resolved_base {
Some(ref b) => {
- // Validate that the explicitly specified base branch exists
- // (Same note as above re: moving to error recovery path for performance)
if !repo.branch_exists(b)? {
return Err(GitError::InvalidReference {
reference: b.clone(),
@@ -627,124 +630,176 @@ pub fn handle_switch(
}
Some(b.clone())
}
- None => {
- // Try to use default branch as base, but only if it actually exists
- // (has commits). For empty repos, the default branch is unborn and
- // git will automatically create an orphan worktree.
- repo.resolve_target_branch(None)
- .ok()
- .filter(|b| repo.local_branch_exists(b).unwrap_or(false))
- }
+ None => repo
+ .resolve_target_branch(None)
+ .ok()
+ .filter(|b| repo.local_branch_exists(b).unwrap_or(false)),
}
} else {
None
};
- // Build args based on whether we're creating or checking out
- if create {
- args.push("-b");
- args.push(&resolved_branch);
- if let Some(ref base_branch) = base_for_creation {
- args.push(base_branch);
+ Ok(SwitchPlan::Create {
+ branch: resolved_branch,
+ worktree_path: expected_path,
+ create_branch: create,
+ base_branch,
+ clobber_backup,
+ new_previous,
+ })
+}
+
+/// Execute a validated switch plan.
+///
+/// Takes a `SwitchPlan` from `plan_switch()` and executes it.
+/// For `SwitchPlan::Existing`, just records history.
+/// For `SwitchPlan::Create`, creates the worktree and runs hooks.
+pub fn execute_switch(
+ repo: &Repository,
+ plan: SwitchPlan,
+ config: &WorktrunkConfig,
+ force: bool,
+ no_verify: bool,
+) -> anyhow::Result<(SwitchResult, SwitchBranchInfo)> {
+ match plan {
+ SwitchPlan::Existing {
+ path,
+ branch,
+ expected_path,
+ new_previous,
+ } => {
+ let _ = repo.record_switch_previous(new_previous.as_deref());
+
+ let current_dir = std::env::current_dir()
+ .ok()
+ .and_then(|p| canonicalize(&p).ok());
+ let already_at_worktree = current_dir
+ .as_ref()
+ .map(|cur| cur == &path)
+ .unwrap_or(false);
+
+ let mismatch_path = if !paths_match(&path, &expected_path) {
+ Some(expected_path)
+ } else {
+ None
+ };
+
+ let result = if already_at_worktree {
+ SwitchResult::AlreadyAt(path)
+ } else {
+ SwitchResult::Existing(path)
+ };
+
+ Ok((
+ result,
+ SwitchBranchInfo {
+ branch,
+ expected_path: mismatch_path,
+ },
+ ))
}
- } else {
- args.push(&resolved_branch);
- }
- // Create worktree and parse specific error cases
- if let Err(e) = repo.run_command(&args) {
- let msg = e.to_string();
- // Check if error is about directory already existing
- if msg.contains("already exists") {
- // Parse the path from git's error message
- // Format: "fatal: '/path/to/dir' already exists"
- if let Some(path_str) = msg
- .lines()
- .find(|line| line.contains("already exists"))
- .and_then(|line| {
- // Extract path between quotes
- line.split('\'').nth(1).or_else(|| line.split('"').nth(1))
- })
- {
- return Err(GitError::WorktreePathExists {
- branch: resolved_branch.clone(),
- path: std::path::PathBuf::from(path_str),
- create,
+ SwitchPlan::Create {
+ branch,
+ worktree_path,
+ create_branch,
+ base_branch,
+ clobber_backup,
+ new_previous,
+ } => {
+ // Handle --clobber backup if needed
+ if let Some(backup_path) = clobber_backup {
+ let path_display = worktrunk::path::format_path_for_display(&worktree_path);
+ let backup_display = worktrunk::path::format_path_for_display(&backup_path);
+ crate::output::print(warning_message(cformat!(
+ "Moving <bold>{path_display}</> to <bold>{backup_display}</> (--clobber)"
+ )))?;
+
+ std::fs::rename(&worktree_path, &backup_path).with_context(|| {
+ format!("Failed to move {path_display} to {backup_display}")
+ })?;
+ }
+
+ // Build git worktree add command
+ let worktree_path_str = worktree_path.to_string_lossy();
+ let mut args = vec!["worktree", "add", worktree_path_str.as_ref()];
+
+ if create_branch {
+ args.push("-b");
+ args.push(&branch);
+ if let Some(ref base) = base_branch {
+ args.push(base);
}
- .into());
+ } else {
+ args.push(&branch);
}
- }
- // Fall back to generic error with context
- // Note: "invalid reference" errors are caught by upfront validation (lines 529, 621)
- return Err(GitError::WorktreeCreationFailed {
- branch: resolved_branch.clone(),
- base_branch: base_for_creation.clone(),
- error: msg,
- }
- .into());
- }
- // Check if git's DWIM created a tracking branch from a remote
- // This happens when we don't use --create and the branch exists on a remote
- let from_remote = if !create {
- // Query the new worktree for its upstream tracking branch
- repo.upstream_branch(&resolved_branch)?
- } else {
- None
- };
+ // Create worktree
+ if let Err(e) = repo.run_command(&args) {
+ return Err(GitError::WorktreeCreationFailed {
+ branch: branch.clone(),
+ base_branch: base_branch.clone(),
+ error: e.to_string(),
+ }
+ .into());
+ }
- // Compute base worktree path once for hooks and result
- let base_worktree_path = base_for_creation
- .as_ref()
- .and_then(|b| repo.worktree_for_branch(b).ok().flatten())
- .map(|p| worktrunk::path::to_posix_path(&p.to_string_lossy()));
-
- // Execute post-create commands (sequential, blocking)
- // Note: If user declines, continue anyway - worktree already created
- if !no_verify {
- let repo_root = repo.worktree_base()?;
- let ctx = CommandContext::new(
- &repo,
- config,
- Some(&resolved_branch),
- &worktree_path,
- &repo_root,
- force,
- );
+ // Check if git's DWIM created a tracking branch from a remote
+ let from_remote = if !create_branch {
+ repo.upstream_branch(&branch)?
+ } else {
+ None
+ };
- let extra_vars: Vec<(&str, &str)> = [
- base_for_creation.as_ref().map(|b| ("base", b.as_str())),
- base_worktree_path
+ // Compute base worktree path for hooks and result
+ let base_worktree_path = base_branch
.as_ref()
- .map(|p| ("base_worktree_path", p.as_str())),
- ]
- .into_iter()
- .flatten()
- .collect();
-
- // Approval was handled at the gate
- ctx.execute_post_create_commands(&extra_vars)?;
- }
+ .and_then(|b| repo.worktree_for_branch(b).ok().flatten())
+ .map(|p| worktrunk::path::to_posix_path(&p.to_string_lossy()));
+
+ // Execute post-create commands
+ if !no_verify {
+ let repo_root = repo.worktree_base()?;
+ let ctx = CommandContext::new(
+ repo,
+ config,
+ Some(&branch),
+ &worktree_path,
+ &repo_root,
+ force,
+ );
- // Note: post-start commands are spawned AFTER success message is shown
- // (see main.rs switch handler for temporal locality)
-
- // Record successful switch in history for `wt switch -` support
- let _ = repo.record_switch_previous(new_previous.as_deref());
-
- Ok((
- SwitchResult::Created {
- path: worktree_path,
- created_branch: create,
- base_branch: base_for_creation,
- base_worktree_path,
- from_remote,
- },
- SwitchBranchInfo {
- branch: resolved_branch,
- expected_path: None, // Created at expected path by definition
- },
- ))
+ let extra_vars: Vec<(&str, &str)> = [
+ base_branch.as_ref().map(|b| ("base", b.as_str())),
+ base_worktree_path
+ .as_ref()
+ .map(|p| ("base_worktree_path", p.as_str())),
+ ]
+ .into_iter()
+ .flatten()
+ .collect();
+
+ ctx.execute_post_create_commands(&extra_vars)?;
+ }
+
+ // Record successful switch in history
+ let _ = repo.record_switch_previous(new_previous.as_deref());
+
+ Ok((
+ SwitchResult::Created {
+ path: worktree_path,
+ created_branch: create_branch,
+ base_branch,
+ base_worktree_path,
+ from_remote,
+ },
+ SwitchBranchInfo {
+ branch,
+ expected_path: None,
+ },
+ ))
+ }
+ }
}
pub fn handle_remove(
@@ -1245,14 +1300,14 @@ mod tests {
fn test_generate_backup_path_with_extension() {
// Paths with extensions: file.txt -> file.txt.bak.TIMESTAMP
let path = PathBuf::from("/tmp/repo.feature");
- let backup = super::generate_backup_path(&path, "20250101-000000");
+ let backup = super::generate_backup_path(&path, "20250101-000000").unwrap();
assert_eq!(
backup,
PathBuf::from("/tmp/repo.feature.bak.20250101-000000")
);
let path = PathBuf::from("/tmp/file.txt");
- let backup = super::generate_backup_path(&path, "20250101-000000");
+ let backup = super::generate_backup_path(&path, "20250101-000000").unwrap();
assert_eq!(backup, PathBuf::from("/tmp/file.txt.bak.20250101-000000"));
}
@@ -1260,14 +1315,25 @@ mod tests {
fn test_generate_backup_path_without_extension() {
// Paths without extensions: foo -> foo.bak.TIMESTAMP
let path = PathBuf::from("/tmp/repo/feature");
- let backup = super::generate_backup_path(&path, "20250101-000000");
+ let backup = super::generate_backup_path(&path, "20250101-000000").unwrap();
assert_eq!(
backup,
PathBuf::from("/tmp/repo/feature.bak.20250101-000000")
);
let path = PathBuf::from("/tmp/mydir");
- let backup = super::generate_backup_path(&path, "20250101-000000");
+ let backup = super::generate_backup_path(&path, "20250101-000000").unwrap();
assert_eq!(backup, PathBuf::from("/tmp/mydir.bak.20250101-000000"));
}
+
+ #[test]
+ fn test_generate_backup_path_unusual_paths() {
+ // Root path has no file name
+ let path = PathBuf::from("/");
+ assert!(super::generate_backup_path(&path, "20250101-000000").is_err());
+
+ // Parent reference has no file name
+ let path = PathBuf::from("..");
+ assert!(super::generate_backup_path(&path, "20250101-000000").is_err());
+ }
}
diff --git a/src/main.rs b/src/main.rs
index 4bab53928..4bc681e33 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,6 @@
use anyhow::Context;
use clap::FromArgMatches;
use color_print::cformat;
-use std::path::PathBuf;
use std::process;
use worktrunk::config::{WorktrunkConfig, expand_template, set_config_path};
use worktrunk::git::{Repository, exit_code, set_base_path};
@@ -32,11 +31,11 @@ use commands::handle_select;
use commands::worktree::{SwitchResult, handle_push};
use commands::{
MergeOptions, RebaseResult, ResolutionContext, SquashResult, add_approvals, approve_hooks,
- clear_approvals, compute_worktree_path, handle_config_create, handle_config_show,
+ clear_approvals, execute_switch, handle_config_create, handle_config_show,
handle_configure_shell, handle_hints_clear, handle_hints_get, handle_hook_show, handle_init,
handle_list, handle_merge, handle_rebase, handle_remove, handle_remove_current,
handle_show_theme, handle_squash, handle_state_clear, handle_state_clear_all, handle_state_get,
- handle_state_set, handle_state_show, handle_switch, handle_unconfigure_shell,
+ handle_state_set, handle_state_show, handle_unconfigure_shell, plan_switch,
resolve_worktree_arg, run_hook, step_commit, step_copy_ignored, step_for_each,
};
use output::{execute_user_command, handle_remove_output, handle_switch_output};
@@ -1337,24 +1336,26 @@ fn main() {
} => WorktrunkConfig::load()
.context("Failed to load config")
.and_then(|mut config| {
+ let repo = Repository::current().context("Failed to switch worktree")?;
+
+ // Validate FIRST (before approval) - fails fast if branch doesn't exist, etc.
+ let plan = plan_switch(&repo, &branch, create, base.as_deref(), clobber, &config)?;
+
// "Approve at the Gate": collect and approve hooks upfront
// This ensures approval happens once at the command entry point
// If user declines, skip hooks but continue with worktree operation
let approved = if verify {
- let repo = Repository::current().context("Failed to switch worktree")?;
let repo_root = repo.worktree_base().context("Failed to switch worktree")?;
- // Compute worktree path for template expansion in approval prompt
- let worktree_path = compute_worktree_path(&repo, &branch, &config)?;
let ctx = CommandContext::new(
&repo,
&config,
- Some(&branch),
- &worktree_path,
+ Some(plan.branch()),
+ plan.worktree_path(),
&repo_root,
yes,
);
// Approve different hooks based on whether we're creating or switching
- if create {
+ if plan.is_create() {
approve_hooks(
&ctx,
&[
@@ -1376,23 +1377,15 @@ fn main() {
// Show message if user declined approval
if !approved {
- crate::output::print(info_message(if create {
+ crate::output::print(info_message(if plan.is_create() {
"Commands declined, continuing worktree creation"
} else {
"Commands declined"
}))?;
}
- // Execute switch operation (creates worktree, runs post-create hooks if approved)
- let (result, branch_info) = handle_switch(
- &branch,
- create,
- base.as_deref(),
- yes,
- clobber,
- skip_hooks,
- &config,
- )?;
+ // Execute the validated plan
+ let (result, branch_info) = execute_switch(&repo, plan, &config, yes, skip_hooks)?;
// Show success message (temporal locality: immediately after worktree operation)
// Returns path to display in hooks when user's shell won't be in the worktree
@@ -1531,143 +1524,165 @@ fn main() {
.into());
}
- // "Approve at the Gate": collect and approve pre-remove hooks upfront
- // This ensures approval happens once at the command entry point
- //
- // TODO(pre-remove-context): The approval context uses current worktree (cwd + current_branch),
- // but hooks execute in each target worktree. When removing another worktree, the approval
- // preview shows the wrong branch/path. Consider building approval context per target worktree.
let repo = Repository::current().context("Failed to remove worktree")?;
- let verify = if verify {
- // Create context for template expansion in approval prompt
- let worktree_path =
- std::env::current_dir().context("Failed to get current directory")?;
- let repo_root = repo.worktree_base().context("Failed to remove worktree")?;
- // Keep as Option so detached HEAD maps to None -> "HEAD" via branch_or_head()
- let current_branch = repo
- .current_worktree()
- .branch()
- .context("Failed to remove worktree")?;
- let ctx = CommandContext::new(
- &repo,
- &config,
- current_branch.as_deref(),
- &worktree_path,
- &repo_root,
- yes,
- );
+
+ // Helper: approve remove hooks using current worktree context
+ // Returns true if hooks should run (user approved)
+ let approve_remove = |yes: bool| -> anyhow::Result<bool> {
+ use commands::context::CommandEnv;
+ let env = CommandEnv::for_action_branchless()?;
+ let ctx = env.context(yes);
let approved =
approve_hooks(&ctx, &[HookType::PreRemove, HookType::PostSwitch])?;
- // If declined, skip hooks but continue with removal
if !approved {
crate::output::print(info_message(
"Commands declined, continuing removal",
))?;
}
- approved
- } else {
- false
+ Ok(approved)
};
if branches.is_empty() {
- // No branches specified, remove current worktree
- // Uses path-based removal to handle detached HEAD state
+ // Single worktree removal: validate FIRST, then approve, then execute
let result =
handle_remove_current(!delete_branch, force_delete, force, &config)
.context("Failed to remove worktree")?;
- // Approval was handled at the gate
- // Post-switch hooks are spawned internally by handle_remove_output
- handle_remove_output(&result, background, verify)
+
+ // "Approve at the Gate": approval happens AFTER validation passes
+ let run_hooks = verify && approve_remove(yes)?;
+
+ handle_remove_output(&result, background, run_hooks)
} else {
+ use commands::worktree::RemoveResult;
use worktrunk::git::ResolvedWorktree;
- // When removing multiple worktrees, we need to handle the current worktree last
- // to avoid deleting the directory we're currently in
- let current_worktree = repo.current_worktree().root().ok();
-
- // Partition branches into current worktree, others, and branch-only.
- // Track all errors (resolution + removal) so we can report them and continue.
- let mut others = Vec::new();
- let mut branch_only = Vec::new();
- let mut current: Option<(PathBuf, Option<String>)> = None;
+
+ // Multi-worktree removal: validate ALL first, then approve, then execute
+ // This supports partial success - some may fail validation while others succeed.
+ let current_worktree = repo
+ .current_worktree()
+ .root()
+ .ok()
+ .and_then(|p| dunce::canonicalize(&p).ok());
+
+ // Dedupe inputs to avoid redundant planning/execution
+ let branches: Vec<_> = {
+ let mut seen = std::collections::HashSet::new();
+ branches
+ .into_iter()
+ .filter(|b| seen.insert(b.clone()))
+ .collect()
+ };
+
+ // Phase 1: Validate all targets (resolution + preparation)
+ // Store successful plans for execution after approval
+ let mut plans_others: Vec<RemoveResult> = Vec::new();
+ let mut plans_branch_only: Vec<RemoveResult> = Vec::new();
+ let mut plan_current: Option<RemoveResult> = None;
let mut all_errors: Vec<anyhow::Error> = Vec::new();
+ // Helper: record error and continue
+ let mut record_error = |e: anyhow::Error| -> anyhow::Result<()> {
+ output::print(e.to_string())?;
+ all_errors.push(e);
+ Ok(())
+ };
+
for branch_name in &branches {
- match resolve_worktree_arg(
+ // Resolve the target
+ let resolved = match resolve_worktree_arg(
&repo,
branch_name,
&config,
ResolutionContext::Remove,
) {
- Ok(ResolvedWorktree::Worktree { path, branch }) => {
- if Some(&path) == current_worktree.as_ref() {
- current = Some((path, branch));
- } else {
- others.push((path, branch));
- }
- }
- Ok(ResolvedWorktree::BranchOnly { branch }) => {
- branch_only.push(branch);
- }
+ Ok(r) => r,
Err(e) => {
- // GitError variants already include emoji via error_message() in Display
- output::print(e.to_string())?;
- all_errors.push(e);
+ record_error(e)?;
+ continue;
}
- }
- }
+ };
- // Remove other worktrees first (approval was handled at the gate)
- for (_path, branch) in &others {
- // Branch is always Some for non-current worktrees - detached worktrees
- // can only be referenced via "@" which resolves to current
- let branch_name = branch
- .as_ref()
- .expect("non-current worktree should have branch");
- match handle_remove(
- branch_name,
- !delete_branch,
- force_delete,
- force,
- &config,
- ) {
- Ok(result) => {
- handle_remove_output(&result, background, verify)?;
+ match resolved {
+ ResolvedWorktree::Worktree { path, branch } => {
+ // Use canonical paths to avoid symlink/normalization mismatches
+ let path_canonical = dunce::canonicalize(&path).unwrap_or(path);
+ let is_current = current_worktree.as_ref() == Some(&path_canonical);
+
+ if is_current {
+ // Current worktree - use handle_remove_current for detached HEAD
+ match handle_remove_current(
+ !delete_branch,
+ force_delete,
+ force,
+ &config,
+ ) {
+ Ok(result) => plan_current = Some(result),
+ Err(e) => record_error(e)?,
+ }
+ continue;
+ }
+
+ // Non-current worktree - branch is always Some because:
+ // - "@" resolves to current worktree (handled by is_current branch above)
+ // - Other names resolve via resolve_worktree_arg which always sets branch: Some(...)
+ let branch_for_remove = branch.as_ref().unwrap();
+
+ match handle_remove(
+ branch_for_remove,
+ !delete_branch,
+ force_delete,
+ force,
+ &config,
+ ) {
+ Ok(result) => plans_others.push(result),
+ Err(e) => record_error(e)?,
+ }
}
- Err(e) => {
- output::print(e.to_string())?;
- all_errors.push(e);
+ ResolvedWorktree::BranchOnly { branch } => {
+ match handle_remove(
+ &branch,
+ !delete_branch,
+ force_delete,
+ force,
+ &config,
+ ) {
+ Ok(result) => plans_branch_only.push(result),
+ Err(e) => record_error(e)?,
+ }
}
}
}
- // Handle branch-only cases (no worktree)
- for branch in &branch_only {
- match handle_remove(branch, !delete_branch, force_delete, force, &config) {
- Ok(result) => {
- handle_remove_output(&result, background, verify)?;
- }
- Err(e) => {
- output::print(e.to_string())?;
- all_errors.push(e);
- }
- }
+ // If no valid plans, bail early (all failed validation)
+ let has_valid_plans = !plans_others.is_empty()
+ || !plans_branch_only.is_empty()
+ || plan_current.is_some();
+ if !has_valid_plans {
+ anyhow::bail!("");
+ }
+
+ // Phase 2: Approve hooks (only if we have valid plans)
+ // TODO(pre-remove-context): Approval context uses current worktree,
+ // but hooks execute in each target worktree.
+ let run_hooks = verify && approve_remove(yes)?;
+
+ // Phase 3: Execute all validated plans
+ // Remove other worktrees first
+ for result in plans_others {
+ handle_remove_output(&result, background, run_hooks)?;
+ }
+
+ // Handle branch-only cases
+ for result in plans_branch_only {
+ handle_remove_output(&result, background, run_hooks)?;
}
// Remove current worktree last (if it was in the list)
- // Post-switch hooks are spawned internally by handle_remove_output
- if let Some((_path, _branch)) = current {
- match handle_remove_current(!delete_branch, force_delete, force, &config) {
- Ok(result) => {
- handle_remove_output(&result, background, verify)?;
- }
- Err(e) => {
- output::print(e.to_string())?;
- all_errors.push(e);
- }
- }
+ if let Some(result) = plan_current {
+ handle_remove_output(&result, background, run_hooks)?;
}
- // Exit with failure if any errors occurred (errors already printed)
+ // Exit with failure if any validation errors occurred
if !all_errors.is_empty() {
anyhow::bail!("");
}
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 4f12d9db3..8cee7633e 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -28,7 +28,7 @@ use super::shell_integration::{
/// Format a switch message based on what was created
///
/// # Message formats
-/// - Branch + worktree created (`--create`): "Created branch X and worktree from Y @ path"
+/// - Branch + worktree created (`--create`): "Created branch X from Y and worktree @ path"
/// - Branch from remote + worktree (DWIM): "Created branch X (tracking remote) and worktree @ path"
/// - Worktree only created: "Created worktree for X @ path"
/// - Switched to existing: "Switched to worktree for X @ path"
@@ -46,7 +46,7 @@ fn format_switch_message(
// --create flag: created branch and worktree
match base_branch {
Some(base) => cformat!(
- "Created branch <bold>{branch}</> and worktree from <bold>{base}</> @ <bold>{path_display}</>"
+ "Created branch <bold>{branch}</> from <bold>{base}</> and worktree @ <bold>{path_display}</>"
),
None => {
cformat!("Created branch <bold>{branch}</> and worktree @ <bold>{path_display}</>")
diff --git a/tests/integration_tests/approval_pty.rs b/tests/integration_tests/approval_pty.rs
index eedb78afa..99f2fcfab 100644
--- a/tests/integration_tests/approval_pty.rs
+++ b/tests/integration_tests/approval_pty.rs
@@ -450,3 +450,42 @@ approved-commands = ["echo 'Second command'"]
normalized
);
}
+
+#[rstest]
+fn test_approval_prompt_remove_decline(repo: TestRepo) {
+ // Create a worktree to remove
+ let output = repo
+ .wt_command()
+ .args(["switch", "--create", "to-remove", "--yes"])
+ .output()
+ .unwrap();
+ assert!(output.status.success(), "Initial switch should succeed");
+
+ // Add pre-remove hook
+ repo.write_project_config(r#"pre-remove = "echo 'pre-remove hook'""#);
+ repo.commit("Add pre-remove config");
+
+ // Configure shell integration
+ repo.configure_shell_integration();
+ let env_vars = test_env_vars_with_shell(&repo);
+
+ // Decline the approval prompt
+ let (output, exit_code) = exec_in_pty_with_input(
+ get_cargo_bin("wt").to_str().unwrap(),
+ &["remove", "to-remove"],
+ repo.root_path(),
+ &env_vars,
+ "n\n",
+ );
+
+ let normalized = normalize_output(&output);
+ assert_eq!(
+ exit_code, 0,
+ "Remove should succeed even when hooks declined"
+ );
+ assert!(
+ normalized.contains("Commands declined"),
+ "Should show 'Commands declined' message"
+ );
+ assert_snapshot!("approval_prompt_remove_decline", normalized);
+}
diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rs
index bf3fa24ba..af0d039a6 100644
--- a/tests/integration_tests/remove.rs
+++ b/tests/integration_tests/remove.rs
@@ -411,6 +411,19 @@ fn test_remove_no_background_deprecated(mut repo: TestRepo) {
));
}
+/// Tests that --force-delete and --no-delete-branch are mutually exclusive
+#[rstest]
+fn test_remove_conflicting_branch_flags(repo: TestRepo) {
+ // Try to use both --force-delete (-D) and --no-delete-branch together
+ // This should fail with an error
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "remove",
+ &["-D", "--no-delete-branch", "nonexistent"],
+ None
+ ));
+}
+
#[rstest]
fn test_remove_foreground_unmerged(mut repo: TestRepo) {
// Create a worktree with an unmerged commit
@@ -1407,3 +1420,22 @@ fn test_remove_path_mismatch_warning_foreground(repo: TestRepo) {
None
));
}
+
+#[rstest]
+fn test_remove_detached_worktree_in_multi(mut repo: TestRepo) {
+ // Create two worktrees
+ let _feature_a = repo.add_worktree("feature-a");
+ let _feature_b = repo.add_worktree("feature-b");
+
+ // Detach HEAD in feature-b
+ repo.detach_head_in_worktree("feature-b");
+
+ // From main, try to multi-remove both
+ // feature-a should succeed, feature-b should fail (detached HEAD)
+ assert_cmd_snapshot!(make_snapshot_cmd(
+ &repo,
+ "remove",
+ &["feature-a", "feature-b"],
+ None
+ ));
+}
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 4fee1adc0..3d91efe42 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -410,6 +410,34 @@ fn test_switch_execute_template_in_args(repo: TestRepo) {
);
}
+#[rstest]
+fn test_switch_execute_template_error(repo: TestRepo) {
+ // Test that invalid templates are rejected with a clear error
+ snapshot_switch(
+ "switch_execute_template_error",
+ &repo,
+ &["--create", "error-test", "--execute", "echo {{ unclosed"],
+ );
+}
+
+#[rstest]
+fn test_switch_execute_arg_template_error(repo: TestRepo) {
+ // Test that invalid templates in trailing args (after --) are rejected
+ snapshot_switch(
+ "switch_execute_arg_template_error",
+ &repo,
+ &[
+ "--create",
+ "arg-error-test",
+ "--execute",
+ "echo",
+ "--",
+ "valid={{ branch }}",
+ "invalid={{ unclosed",
+ ],
+ );
+}
+
// --no-verify flag tests
#[rstest]
fn test_switch_no_config_commands_execute_still_runs(repo: TestRepo) {
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
index d4b4cec2b..88481f15d 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_accept.snap
@@ -12,6 +12,6 @@ y
◎ Running post-create project hook @ _REPO_/repo.BRANCH:
  echo 'test command'
test command
-✓ Created branch test-approve and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-approve from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
index b16bf8df0..1a8af0d9c 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_decline.snap
@@ -10,6 +10,6 @@ n
  echo 'test command'
❯ Allow and remember? [y/N]
○ Commands declined, continuing worktree creation
-✓ Created branch test-decline and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-decline from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
index 0c732a3ea..31f67e77f 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_accept.snap
@@ -20,6 +20,6 @@ y
◎ Running post-create project:third @ _REPO_/repo.BRANCH:
  echo 'Third command'
Third command
-✓ Created branch test-mixed-accept and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-mixed-accept from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
index 6275cd2fc..04bd31f4e 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_mixed_approved_unapproved_decline.snap
@@ -12,6 +12,6 @@ n
  echo 'Third command'
❯ Allow and remember? [y/N]
○ Commands declined, continuing worktree creation
-✓ Created branch test-mixed-decline and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-mixed-decline from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
index a46aa5248..fc4570295 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_multiple_commands.snap
@@ -22,6 +22,6 @@ y
◎ Running post-create project:third @ _REPO_/repo.BRANCH:
  echo 'Third command'
Third command
-✓ Created branch test-multi and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-multi from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
index c3616ec6a..4e0a491f6 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_named_commands.snap
@@ -22,6 +22,6 @@ y
◎ Running post-create project:test @ _REPO_/repo.BRANCH:
  echo 'Running tests...'
Running tests...
-✓ Created branch test-named and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-named from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
index 777f87475..20bf012c5 100644
--- a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_permission_error.snap
@@ -14,6 +14,6 @@ y
◎ Running post-create project hook @ _REPO_/repo.BRANCH:
  echo 'test command'
test command
-✓ Created branch test-permission and worktree from main @ _REPO_/repo.BRANCH
+✓ Created branch test-permission from main and worktree @ _REPO_/repo.BRANCH
↳ Customize worktree locations: wt config create
▲ Cannot change directory — ran [BIN]; shell integration wraps wt
diff --git a/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_remove_decline.snap b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_remove_decline.snap
new file mode 100644
index 000000000..242f481f8
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__approval_pty__approval_prompt_remove_decline.snap
@@ -0,0 +1,13 @@
+---
+source: tests/integration_tests/approval_pty.rs
+expression: normalized
+---
+n
+
+▲ repo needs approval to execute 1 command:
+
+○ pre-remove:
+  echo 'pre-remove hook'
+❯ Allow and remember? [y/N]
+○ Commands declined, continuing removal
+◎ Removing to-remove worktree & branch in background (ancestor of main, ⊂)
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap b/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap
index bebb2f95c..5cfa659ba 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create project hook @ _REPO_.test-approved:
  echo 'approved' > output.txt
-✓ Created branch test-approved and worktree from main @ _REPO_.test-approved
+✓ Created branch test-approved from main and worktree @ _REPO_.test-approved
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__yes_bypasses_tty_check.snap b/tests/snapshots/integration__integration_tests__approval_ui__yes_bypasses_tty_check.snap
index 1d3e69520..e90677409 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__yes_bypasses_tty_check.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__yes_bypasses_tty_check.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -37,7 +37,7 @@ exit_code: 0
◎ Running post-create project hook @ _REPO_.test-yes-tty:
  echo 'test command'
test command
-✓ Created branch test-yes-tty and worktree from main @ _REPO_.test-yes-tty
+✓ Created branch test-yes-tty from main and worktree @ _REPO_.test-yes-tty
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__yes_does_not_save_approvals_first_run.snap b/tests/snapshots/integration__integration_tests__approval_ui__yes_does_not_save_approvals_first_run.snap
index f97589932..50d2fef0b 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__yes_does_not_save_approvals_first_run.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__yes_does_not_save_approvals_first_run.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create project hook @ _REPO_.test-yes:
  echo 'test command' > output.txt
-✓ Created branch test-yes and worktree from main @ _REPO_.test-yes
+✓ Created branch test-yes from main and worktree @ _REPO_.test-yes
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_simple_switch.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_simple_switch.snap
index 1cd15d958..596fe2706 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_simple_switch.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_simple_switch.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch fix-auth and worktree from main @ _REPO_.fix-auth
+✓ Created branch fix-auth from main and worktree @ _REPO_.fix-auth
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
index 7ff0207ef..02d28d4ba 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create project hook @ _REPO_.feature:
  echo 'Setup done' > setup.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
index 9a17edfda..92ded7208 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Executing echo 'Execute flag' > execute.txt @ _REPO_.feature, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_base_variables.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_base_variables.snap
index a2b6d1048..858fcc46e 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_base_variables.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_base_variables.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -39,7 +39,7 @@ exit_code: 0
  echo 'Base: main' > base_info.txt
◎ Running post-create project:base_path @ _REPO_.feature:
  echo 'Base Path: _REPO_' >> base_info.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_default_branch_template.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_default_branch_template.snap
index 0beba58f9..68edeb47d 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_default_branch_template.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_default_branch_template.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create project hook @ _REPO_.feature:
  echo 'Default: main' > default.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
index 2d1d22d6c..fe7eeb885 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
@@ -36,7 +36,7 @@ exit_code: 0
◎ Running post-create project hook @ _REPO_.feature:
  exit 1
✗ Command failed: exit status: 1
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap
index 1d9f1304e..8b09d0f42 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_git_variables_template.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -42,7 +42,7 @@ exit_code: 0
  echo 'Remote: origin' >> git_vars.txt
◎ Running post-create project:worktree_name @ _REPO_.feature:
  echo 'Worktree Name: repo.feature' >> git_vars.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
index 054fa4281..74b86b70f 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -39,6 +39,6 @@ exit_code: 0
  else
   echo 'File exists' > result.txt
  fi
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
index c70c20505..93270b0c1 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -39,7 +39,7 @@ exit_code: 0
◎ Running post-create project:setup @ _REPO_.feature:
  echo 'Running setup'
Running setup
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
index d93ead831..4400599cb 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_no_config.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
index b3e7640a8..5c9946475 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
◎ Running post-create project hook @ _REPO_.feature:
  echo 'Setup complete'
Setup complete
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
index f6e0d950a..7f034b0ed 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -43,6 +43,6 @@ exit_code: 0
  echo 'Worktree: _REPO_.feature-test' >> info.txt
◎ Running post-create project:root @ _REPO_.feature-test:
  echo 'Root: _REPO_' >> info.txt
-✓ Created branch feature/test and worktree from main @ _REPO_.feature-test
+✓ Created branch feature/test from main and worktree @ _REPO_.feature-test
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_upstream_template.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_upstream_template.snap
index 1a0af6ef3..5f06fa96a 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_upstream_template.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_upstream_template.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create project hook @ _REPO_.feature:
  echo 'Upstream: ' > upstream.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
index 82854f53c..cce08249e 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
index 3afa129ea..55a277fe9 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
index f31c605dd..b120b631d 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
index 8978b41a4..4c80575e1 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
index eacead26a..9e55dfd86 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
◎ Running post-start project hook @ _REPO_.feature:
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
index cb4314430..cb0641722 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
index 0d1b18e5d..1a1a6ab21 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
index fa951f25d..cf577c24b 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_at_from_detached_head_in_worktree.snap b/tests/snapshots/integration__integration_tests__remove__remove_at_from_detached_head_in_worktree.snap
index 8bb028fb3..37ff68d8c 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_at_from_detached_head_in_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_at_from_detached_head_in_worktree.snap
@@ -8,7 +8,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_conflicting_branch_flags.snap b/tests/snapshots/integration__integration_tests__remove__remove_conflicting_branch_flags.snap
new file mode 100644
index 000000000..e7a090e9b
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_conflicting_branch_flags.snap
@@ -0,0 +1,37 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "-D"
+ - "--no-delete-branch"
+ - nonexistent
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✗ Cannot use --force-delete with --no-delete-branch
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_detached_worktree_in_multi.snap b/tests/snapshots/integration__integration_tests__remove__remove_detached_worktree_in_multi.snap
new file mode 100644
index 000000000..a692cb172
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_detached_worktree_in_multi.snap
@@ -0,0 +1,38 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - feature-a
+ - feature-b
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature-a worktree & branch in background (same commit as main, _)
+▲ No worktree found for branch feature-b
+✓ Removed branch feature-b (same commit as main, _)
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_locked_detached_multi.snap b/tests/snapshots/integration__integration_tests__remove__remove_locked_detached_multi.snap
index cc9c118ac..b96eed734 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_locked_detached_multi.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_locked_detached_multi.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,6 +33,6 @@ exit_code: 1
----- stdout -----
----- stderr -----
-◎ Removing other worktree & branch in background (same commit as main, _)
✗ Cannot remove repo.locked-detached, worktree is locked (Locked detached)
↳ To unlock, run git worktree unlock _REPO_.locked-detached
+◎ Removing other worktree & branch in background (same commit as main, _)
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_partial_success.snap b/tests/snapshots/integration__integration_tests__remove__remove_partial_success.snap
index d3dc2c488..beb4bf170 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_partial_success.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_partial_success.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,5 +33,5 @@ exit_code: 1
----- stdout -----
----- stderr -----
-◎ Removing feature worktree & branch in background (same commit as main, _)
✗ No worktree found for branch nonexistent
+◎ Removing feature worktree & branch in background (same commit as main, _)
diff --git a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap
index e24c32c47..b0a2437cb 100644
--- a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap
+++ b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_accept.snap
@@ -4,7 +4,7 @@ expression: normalized
---
y
-✓ Created branch feature and worktree from main @ [REPO]/repo.feature
+✓ Created branch feature from main and worktree @ [REPO]/repo.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
diff --git a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_decline.snap b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_decline.snap
index be84fcbd4..f3f8773f6 100644
--- a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_decline.snap
+++ b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_decline.snap
@@ -4,7 +4,7 @@ expression: normalized
---
n
-✓ Created branch feature and worktree from main @ [REPO]/repo.feature
+✓ Created branch feature from main and worktree @ [REPO]/repo.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
diff --git a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_preview_decline.snap b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_preview_decline.snap
index bd2eb5c9d..d275c3a61 100644
--- a/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_preview_decline.snap
+++ b/tests/snapshots/integration__integration_tests__shell_integration_prompt__pty_tests__prompt_preview_decline.snap
@@ -5,7 +5,7 @@ expression: normalized
?
n
-✓ Created branch feature and worktree from main @ [REPO]/repo.feature
+✓ Created branch feature from main and worktree @ [REPO]/repo.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
index 592645d0d..3b8730083 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__bash_shell_integration_hint_suppressed.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch bash-test and worktree from main @ [TMPDIR]/repo.bash-test
+✓ Created branch bash-test from main and worktree @ [TMPDIR]/repo.bash-test
↳ Customize worktree locations: wt config create
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
index 1213e287a..7e4adfc61 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_multiline_command_execution.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch fish-multiline and worktree from main @ [TMPDIR]/repo.fish-multiline
+✓ Created branch fish-multiline from main and worktree @ [TMPDIR]/repo.fish-multiline
↳ Customize worktree locations: wt config create
◎ Executing (--execute):
  echo 'line 1'; echo 'line 2'; echo 'line 3'
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
index b0e72ca3f..824a18077 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_handles_empty_chunks.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch fish-minimal and worktree from main @ [TMPDIR]/repo.fish-minimal
+✓ Created branch fish-minimal from main and worktree @ [TMPDIR]/repo.fish-minimal
↳ Customize worktree locations: wt config create
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
index 18316fc8c..267e0a79b 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__fish_wrapper_preserves_progress_messages.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch fish-bg and worktree from main @ [TMPDIR]/repo.fish-bg
+✓ Created branch fish-bg from main and worktree @ [TMPDIR]/repo.fish-bg
↳ Customize worktree locations: wt config create
◎ Running post-start project hook:
  echo 'fish background task'
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
index e14908ae1..dda5f6aeb 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_post_create.snap
@@ -7,7 +7,7 @@ expression: output.normalized()
Resolved 24 packages in 145ms
Installed 24 packages in 1.2s
-✓ Created branch feature-x and worktree from main @ [TMPDIR]/repo.feature-x
+✓ Created branch feature-x from main and worktree @ [TMPDIR]/repo.feature-x
↳ Customize worktree locations: wt config create
◎ Running post-start project:dev:
  uv run dev
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap
index e41a73327..ac5182bc9 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_simple_switch.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch fix-auth and worktree from main @ [TMPDIR]/repo.fix-auth
+✓ Created branch fix-auth from main and worktree @ [TMPDIR]/repo.fix-auth
↳ Customize worktree locations: wt config create
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
index e3142f7ee..68f2e5752 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_create.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch feature and worktree from main @ [TMPDIR]/repo.feature
+✓ Created branch feature from main and worktree @ [TMPDIR]/repo.feature
↳ Customize worktree locations: wt config create
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
index 5176f18e8..6f5c023e0 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch test-exec and worktree from main @ [TMPDIR]/repo.test-exec
+✓ Created branch test-exec from main and worktree @ [TMPDIR]/repo.test-exec
↳ Customize worktree locations: wt config create
◎ Executing (--execute):
  echo executed
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
index 5176f18e8..6f5c023e0 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_execute_through_wrapper.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch test-exec and worktree from main @ [TMPDIR]/repo.test-exec
+✓ Created branch test-exec from main and worktree @ [TMPDIR]/repo.test-exec
↳ Customize worktree locations: wt config create
◎ Executing (--execute):
  echo executed
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
index 447a732fc..48b49c78c 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_hooks_zsh.snap
@@ -8,7 +8,7 @@ Installing dependencies...
◎ Running post-create project:build:
  echo 'Building project...'
Building project...
-✓ Created branch feature-hooks and worktree from main @ [TMPDIR]/repo.feature-hooks
+✓ Created branch feature-hooks from main and worktree @ [TMPDIR]/repo.feature-hooks
↳ Customize worktree locations: wt config create
◎ Running post-start project:server:
  echo 'Starting dev server on port 3000'
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
index 0b1cc7b32..0527ca1b5 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__switch_with_post_start_command_no_directive_leak.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch feature-with-hooks and worktree from main @ [TMPDIR]/repo.feature-with-hooks
+✓ Created branch feature-with-hooks from main and worktree @ [TMPDIR]/repo.feature-with-hooks
↳ Customize worktree locations: wt config create
◎ Running post-start project hook:
  echo 'test command executed'
diff --git a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
index 66b9f85b6..9cb10e9c1 100644
--- a/tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
+++ b/tests/snapshots/integration__integration_tests__shell_wrapper__tests__wrapper_preserves_progress_messages.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✓ Created branch feature-bg and worktree from main @ [TMPDIR]/repo.feature-bg
+✓ Created branch feature-bg from main and worktree @ [TMPDIR]/repo.feature-bg
↳ Customize worktree locations: wt config create
◎ Running post-start project hook:
  echo 'background task'
diff --git a/tests/snapshots/integration__integration_tests__switch__create_with_base_main.snap b/tests/snapshots/integration__integration_tests__switch__create_with_base_main.snap
index 9bf6a69f0..4feebd73b 100644
--- a/tests/snapshots/integration__integration_tests__switch__create_with_base_main.snap
+++ b/tests/snapshots/integration__integration_tests__switch__create_with_base_main.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch new-feature and worktree from main @ _REPO_.new-feature
+✓ Created branch new-feature from main and worktree @ _REPO_.new-feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snap
index cbdeed838..afd6c9eac 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snap
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
▲ Moving _REPO_.clobber-ext.txt to _REPO_.clobber-ext.txt.bak.20250102-000000 (--clobber)
-✓ Created branch clobber-ext.txt and worktree from main @ _REPO_.clobber-ext.txt
+✓ Created branch clobber-ext.txt from main and worktree @ _REPO_.clobber-ext.txt
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snap
index d23c72d9f..27fcc7fff 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snap
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
▲ Moving _REPO_.clobber-dir-test to _REPO_.clobber-dir-test.bak.20250102-000000 (--clobber)
-✓ Created branch clobber-dir-test and worktree from main @ _REPO_.clobber-dir-test
+✓ Created branch clobber-dir-test from main and worktree @ _REPO_.clobber-dir-test
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snap
index d3029c7d2..67e665340 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snap
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
▲ Moving _REPO_.clobber-file-test to _REPO_.clobber-file-test.bak.20250102-000000 (--clobber)
-✓ Created branch clobber-file-test and worktree from main @ _REPO_.clobber-file-test
+✓ Created branch clobber-file-test from main and worktree @ _REPO_.clobber-file-test
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
index a3558afba..10cf5d33a 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_new.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature-x and worktree from main @ _REPO_.feature-x
+✓ Created branch feature-x from main and worktree @ _REPO_.feature-x
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap
index 17efdcafb..526c54f27 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_no_remote.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap
index c4013753f..157a871d9 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_remote_only.snap
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
▲ Branch remote-feature exists on remote (origin/remote-feature); creating new branch from base instead
↳ To switch to the remote branch, remove this added branch and then run without --create: wt remove remote-feature && wt switch remote-feature
-✓ Created branch remote-feature and worktree from main @ _REPO_.remote-feature
+✓ Created branch remote-feature from main and worktree @ _REPO_.remote-feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_arg_template_error.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_arg_template_error.snap
new file mode 100644
index 000000000..6d70dab8a
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_arg_template_error.snap
@@ -0,0 +1,45 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "--create"
+ - arg-error-test
+ - "--execute"
+ - echo
+ - "--"
+ - "valid={{ branch }}"
+ - "invalid={{ unclosed"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✓ Created branch arg-error-test from main and worktree @ _REPO_.arg-error-test
+↳ Customize worktree locations: wt config create
+▲ Executing echo @ _REPO_.arg-error-test, but shell directory unchanged — shell integration not installed
+↳ To enable automatic cd, run wt config shell install
+✗ Failed to expand argument template: Template syntax error: syntax error: unexpected end of input, expected end of variable block (in <string>:1)
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
index ced18c878..9af3f0bf2 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch file-test and worktree from main @ _REPO_.file-test
+✓ Created branch file-test from main and worktree @ _REPO_.file-test
↳ Customize worktree locations: wt config create
▲ Executing echo 'test content' > test.txt @ _REPO_.file-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
index 5f9079c6b..86380a077 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 1
----- stdout -----
----- stderr -----
-✓ Created branch fail-test and worktree from main @ _REPO_.fail-test
+✓ Created branch fail-test from main and worktree @ _REPO_.fail-test
↳ Customize worktree locations: wt config create
▲ Executing exit 1 @ _REPO_.fail-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
index 2aab6f309..842d68e39 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -38,7 +38,7 @@ line2
line3
----- stderr -----
-✓ Created branch multiline-test and worktree from main @ _REPO_.multiline-test
+✓ Created branch multiline-test from main and worktree @ _REPO_.multiline-test
↳ Customize worktree locations: wt config create
▲ Executing echo 'line1'
echo 'line2'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
index 2dbda72e2..bb3704425 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
test output
----- stderr -----
-✓ Created branch exec-test and worktree from main @ _REPO_.exec-test
+✓ Created branch exec-test from main and worktree @ _REPO_.exec-test
↳ Customize worktree locations: wt config create
▲ Executing echo 'test output' @ _REPO_.exec-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap
index 42c250c00..503fc161d 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_base.snap
@@ -38,7 +38,7 @@ exit_code: 0
base=main
----- stderr -----
-✓ Created branch from-main and worktree from main @ _REPO_.from-main
+✓ Created branch from-main from main and worktree @ _REPO_.from-main
↳ Customize worktree locations: wt config create
▲ Executing echo 'base={{ base }}' @ _REPO_.from-main, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_branch.snap
index 375f3a3ac..a50704e77 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_branch.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_branch.snap
@@ -36,7 +36,7 @@ exit_code: 0
branch=template-test
----- stderr -----
-✓ Created branch template-test and worktree from main @ _REPO_.template-test
+✓ Created branch template-test from main and worktree @ _REPO_.template-test
↳ Customize worktree locations: wt config create
▲ Executing echo 'branch={{ branch }}' @ _REPO_.template-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_error.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_error.snap
new file mode 100644
index 000000000..45badf68e
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_error.snap
@@ -0,0 +1,42 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "--create"
+ - error-test
+ - "--execute"
+ - "echo {{ unclosed"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+✓ Created branch error-test from main and worktree @ _REPO_.error-test
+↳ Customize worktree locations: wt config create
+▲ Executing echo {{ unclosed @ _REPO_.error-test, but shell directory unchanged — shell integration not installed
+↳ To enable automatic cd, run wt config shell install
+✗ Failed to expand --execute template: Template syntax error: syntax error: unexpected end of input, expected end of variable block (in <string>:1)
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_in_args.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_in_args.snap
index 2097f3abe..0f186d76c 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_in_args.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_in_args.snap
@@ -39,7 +39,7 @@ exit_code: 0
branch=args-test repo=repo
----- stderr -----
-✓ Created branch args-test and worktree from main @ _REPO_.args-test
+✓ Created branch args-test from main and worktree @ _REPO_.args-test
↳ Customize worktree locations: wt config create
▲ Executing echo @ _REPO_.args-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_shell_escape.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_shell_escape.snap
index c31d856ae..d320dcfea 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_shell_escape.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_shell_escape.snap
@@ -36,7 +36,7 @@ exit_code: 0
feat;id
----- stderr -----
-✓ Created branch feat;id and worktree from main @ _REPO_.feat;id
+✓ Created branch feat;id from main and worktree @ _REPO_.feat;id
↳ Customize worktree locations: wt config create
▲ Executing echo {{ branch }} @ _REPO_.feat;id, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap
index 4384dc902..ffc0f7028 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_with_filter.snap
@@ -36,7 +36,7 @@ exit_code: 0
sanitized=feature-with-slash
----- stderr -----
-✓ Created branch feature/with-slash and worktree from main @ _REPO_.feature-with-slash
+✓ Created branch feature/with-slash from main and worktree @ _REPO_.feature-with-slash
↳ Customize worktree locations: wt config create
▲ Executing echo 'sanitized={{ branch | sanitize }}' @ _REPO_.feature-with-slash, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap
index 9c5bb29ce..05fd56b99 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_template_worktree_path.snap
@@ -36,7 +36,7 @@ exit_code: 0
path=_REPO_.path-test
----- stderr -----
-✓ Created branch path-test and worktree from main @ _REPO_.path-test
+✓ Created branch path-test from main and worktree @ _REPO_.path-test
↳ Customize worktree locations: wt config create
▲ Executing echo 'path={{ worktree_path }}' @ _REPO_.path-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap
index 2729d05ce..a96ce3094 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_exit_code.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch exit-code-test and worktree from main @ _REPO_.exit-code-test
+✓ Created branch exit-code-test from main and worktree @ _REPO_.exit-code-test
↳ Customize worktree locations: wt config create
◎ Executing (--execute):
  exit 42
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap
index 6ceba852b..ddce56376 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_execute_output_then_exit.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch output-exit-test and worktree from main @ _REPO_.output-exit-test
+✓ Created branch output-exit-test from main and worktree @ _REPO_.output-exit-test
↳ Customize worktree locations: wt config create
◎ Executing (--execute):
  echo 'doing work'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
index 71d3be35b..8776133f6 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -34,5 +34,5 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch internal-test and worktree from main @ _REPO_.internal-test
+✓ Created branch internal-test from main and worktree @ _REPO_.internal-test
↳ Customize worktree locations: wt config create
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
index 44a6778d0..25ff8b989 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -36,7 +36,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch exec-internal and worktree from main @ _REPO_.exec-internal
+✓ Created branch exec-internal from main and worktree @ _REPO_.exec-internal
↳ Customize worktree locations: wt config create
◎ Executing (--execute):
  echo 'line1'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_execute_still_runs.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_execute_still_runs.snap
index 6bbf4897f..9b8fb3a65 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_execute_still_runs.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_execute_still_runs.snap
@@ -12,7 +12,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -37,7 +37,7 @@ exit_code: 0
execute command runs
----- stderr -----
-✓ Created branch no-hooks-test and worktree from main @ _REPO_.no-hooks-test
+✓ Created branch no-hooks-test from main and worktree @ _REPO_.no-hooks-test
↳ Customize worktree locations: wt config create
▲ Executing echo 'execute command runs' @ _REPO_.no-hooks-test, but shell directory unchanged — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_skips_post_start.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_skips_post_start.snap
index a31226ddc..a43aca254 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_skips_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_skips_post_start.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -34,7 +34,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch no-post-start and worktree from main @ _REPO_.no-post-start
+✓ Created branch no-post-start from main and worktree @ _REPO_.no-post-start
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_with_yes.snap b/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_with_yes.snap
index b08fab381..410a47fdc 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_with_yes.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_no_hooks_with_yes.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch yes-no-hooks and worktree from main @ _REPO_.yes-no-hooks
+✓ Created branch yes-no-hooks from main and worktree @ _REPO_.yes-no-hooks
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_post_hook_no_path_with_shell_integration.snap b/tests/snapshots/integration__integration_tests__switch__switch_post_hook_no_path_with_shell_integration.snap
index 5abbecd46..d1019022b 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_post_hook_no_path_with_shell_integration.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_post_hook_no_path_with_shell_integration.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch post-hook-shell-test and worktree from main @ _REPO_.post-hook-shell-test
+✓ Created branch post-hook-shell-test from main and worktree @ _REPO_.post-hook-shell-test
↳ Customize worktree locations: wt config create
◎ Running post-switch project hook:
  echo switched
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_post_hook_path_annotation.snap b/tests/snapshots/integration__integration_tests__switch__switch_post_hook_path_annotation.snap
index 51ad9f003..9b1627b0d 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_post_hook_path_annotation.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_post_hook_path_annotation.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -34,7 +34,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch post-hook-test and worktree from main @ _REPO_.post-hook-test
+✓ Created branch post-hook-test from main and worktree @ _REPO_.post-hook-test
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_primary_on_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_primary_on_different_branch.snap
index 8d5483156..841f7a889 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_primary_on_different_branch.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_primary_on_different_branch.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature-from-main and worktree from main @ _REPO_.feature-from-main
+✓ Created branch feature-from-main from main and worktree @ _REPO_.feature-from-main
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap b/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap
index f80c9e158..334627748 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_with_base.snap
@@ -11,7 +11,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature-with-base and worktree from main @ _REPO_.feature-with-base
+✓ Created branch feature-with-base from main and worktree @ _REPO_.feature-with-base
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__no_verify_skips_all_hooks.snap b/tests/snapshots/integration__integration_tests__user_hooks__no_verify_skips_all_hooks.snap
index a1d7add45..3beb9bc6e 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__no_verify_skips_all_hooks.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__no_verify_skips_all_hooks.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -34,7 +34,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
index 3f54532be..dab9367e7 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_and_project_post_start.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_hook_template_vars.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_hook_template_vars.snap
index 1b101d5c1..d114dda29 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_hook_template_vars.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_hook_template_vars.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create user:vars @ _REPO_.feature:
  echo 'repo=repo branch=feature' > template_vars.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_before_project.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_before_project.snap
index 17d604f5a..0633dc378 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_before_project.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_before_project.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -37,7 +37,7 @@ exit_code: 0
  echo 'USER_HOOK' >> hook_order.txt
◎ Running post-create project hook @ _REPO_.feature:
  echo 'PROJECT_HOOK' >> hook_order.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_no_approval.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_no_approval.snap
index 9a490faea..a0e77ce6a 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_no_approval.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_hooks_no_approval.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create user:setup @ _REPO_.feature:
  echo 'NO_APPROVAL_NEEDED' > no_approval.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_executes.snap
index 75b998a1e..797e358eb 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_executes.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -35,7 +35,7 @@ exit_code: 0
----- stderr -----
◎ Running post-create user:log @ _REPO_.feature:
  echo 'USER_POST_CREATE_RAN' > user_hook_marker.txt
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_failure.snap
index 0061737e9..c4e6b8bca 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_create_failure.snap
@@ -36,7 +36,7 @@ exit_code: 0
◎ Running post-create user:failing @ _REPO_.feature:
  exit 1
✗ Command failing failed: exit status: 1
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap
index 024405bef..4906fbbb4 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_executes.snap
@@ -9,7 +9,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -33,7 +33,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped_no_verify.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped_no_verify.snap
index a1d7add45..3beb9bc6e 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_start_skipped_no_verify.snap
@@ -10,7 +10,7 @@ info:
env:
APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
- COLUMNS: "150"
+ COLUMNS: "500"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
@@ -34,7 +34,7 @@ exit_code: 0
----- stdout -----
----- stderr -----
-✓ Created branch feature and worktree from main @ _REPO_.feature
+✓ Created branch feature from main and worktree @ _REPO_.feature
↳ Customize worktree locations: wt config create
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install