Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refactor: Replace `expect` with `unwrap` in tests
Maximilian Roos7a05a54aaa8b
diff --git a/src/config/commands.rs b/src/config/commands.rsindex 0ce91920c..40f394e3e 100644--- a/src/config/commands.rs+++ b/src/config/commands.rs@@ -152,10 +152,7 @@ impl Serialize for CommandConfig {// At this point, all commands must have names (from Named TOML format)let mut map = serializer.serialize_map(Some(self.commands.len()))?;for cmd in &self.commands {- let key = cmd- .name- .as_ref()- .expect("named format requires all commands to have names");+ let key = cmd.name.as_ref().unwrap();map.serialize_entry(key, &cmd.template)?;}map.end()diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rsindex fe630058f..672b0486e 100644--- a/src/git/repository/mod.rs+++ b/src/git/repository/mod.rs@@ -110,7 +110,7 @@ impl Repository {let _ = self.layout.set(layout);// Now get() will succeed- Ok(self.layout.get().expect("just set"))+ Ok(self.layout.get().unwrap())}/// Check if this is a bare repository (no working tree).diff --git a/src/help_resolver.rs b/src/help_resolver.rsindex 665868b7c..3e8567313 100644--- a/src/help_resolver.rs+++ b/src/help_resolver.rs@@ -57,9 +57,7 @@ fn extract_subcommand_path(/// Navigate to a subcommand by following a pathfn navigate_to_command<'a>(mut cmd: &'a mut Command, path: &[String]) -> &'a mut Command {for name in path {- cmd = cmd- .find_subcommand_mut(name)- .expect("subcommand should exist if it was in the path");+ cmd = cmd.find_subcommand_mut(name).unwrap();}cmd}diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex af054ed12..c29bfd88d 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -115,14 +115,12 @@ pub struct TestRepo {impl TestRepo {/// Create a new test repository with isolated git environmentpub fn new() -> Self {- let temp_dir = TempDir::new().expect("Failed to create temp directory");+ let temp_dir = TempDir::new().unwrap();// Create main repo as a subdirectory so worktrees can be siblingslet root = temp_dir.path().join("test-repo");- std::fs::create_dir(&root).expect("Failed to create main repo directory");+ std::fs::create_dir(&root).unwrap();// Canonicalize to resolve symlinks (important on macOS where /var is symlink to /private/var)- let root = root- .canonicalize()- .expect("Failed to canonicalize temp path");+ let root = root.canonicalize().unwrap();// Create isolated config path for this testlet test_config_path = temp_dir.path().join("test-config.toml");@@ -133,7 +131,7 @@ impl TestRepo {&git_config_path,"[advice]\n\tmergeConflict = false\n\tresolveConflict = false\n",)- .expect("Failed to write git config");+ .unwrap();let repo = Self {temp_dir,@@ -151,7 +149,7 @@ impl TestRepo {cmd.args(["init", "-b", "main"]).current_dir(&repo.root).output()- .expect("Failed to init git repo");+ .unwrap();// Configure git userlet mut cmd = Command::new("git");@@ -159,14 +157,14 @@ impl TestRepo {cmd.args(["config", "user.name", "Test User"]).current_dir(&repo.root).output()- .expect("Failed to set user.name");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["config", "user.email", "[email protected]"]).current_dir(&repo.root).output()- .expect("Failed to set user.email");+ .unwrap();repo}@@ -285,13 +283,13 @@ impl TestRepo {/// Write project-specific config (`.config/wt.toml`) under the repo root.pub fn write_project_config(&self, contents: &str) {let config_dir = self.root_path().join(".config");- std::fs::create_dir_all(&config_dir).expect("Failed to create .config dir");- std::fs::write(config_dir.join("wt.toml"), contents).expect("Failed to write wt.toml");+ std::fs::create_dir_all(&config_dir).unwrap();+ std::fs::write(config_dir.join("wt.toml"), contents).unwrap();}/// Overwrite the isolated WORKTRUNK_CONFIG_PATH used during tests.pub fn write_test_config(&self, contents: &str) {- std::fs::write(&self.test_config_path, contents).expect("Failed to write test config");+ std::fs::write(&self.test_config_path, contents).unwrap();}/// Get the path to a named worktree@@ -305,15 +303,13 @@ impl TestRepo {pub fn commit(&self, message: &str) {// Create a file to ensure there's something to commitlet file_path = self.root.join("file.txt");- std::fs::write(&file_path, message).expect("Failed to write file");+ std::fs::write(&file_path, message).unwrap();- self.git_command(&["add", "."])- .output()- .expect("Failed to git add");+ self.git_command(&["add", "."]).output().unwrap();self.git_command(&["commit", "-m", message]).output()- .expect("Failed to git commit");+ .unwrap();}/// Create a commit with a custom message (useful for testing malicious messages)@@ -325,15 +321,13 @@ impl TestRepo {.unwrap().as_nanos();let file_path = self.root.join(format!("file-{}.txt", timestamp));- std::fs::write(&file_path, "content").expect("Failed to write file");+ std::fs::write(&file_path, "content").unwrap();- self.git_command(&["add", "."])- .output()- .expect("Failed to git add");+ self.git_command(&["add", "."]).output().unwrap();self.git_command(&["commit", "-m", message]).output()- .expect("Failed to git commit");+ .unwrap();}/// Add a worktree with the given name and branch@@ -353,7 +347,7 @@ impl TestRepo {]).current_dir(&self.root).output()- .expect("Failed to execute git worktree add");+ .unwrap();if !output.status.success() {panic!(@@ -364,9 +358,7 @@ impl TestRepo {}// Canonicalize worktree path to match what git returns- let canonical_path = worktree_path- .canonicalize()- .expect("Failed to canonicalize worktree path");+ let canonical_path = worktree_path.canonicalize().unwrap();self.worktrees.insert(name.to_string(), canonical_path.clone());canonical_path@@ -384,7 +376,7 @@ impl TestRepo {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(self.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();main_wt}@@ -397,7 +389,7 @@ impl TestRepo {.args(["rev-parse", "HEAD"]).current_dir(&self.root).output()- .expect("Failed to get HEAD SHA");+ .unwrap();let sha = String::from_utf8_lossy(&output.stdout).trim().to_string();@@ -406,7 +398,7 @@ impl TestRepo {cmd.args(["checkout", "--detach", &sha]).current_dir(&self.root).output()- .expect("Failed to detach HEAD");+ .unwrap();}/// Lock a worktree with an optional reason@@ -422,10 +414,7 @@ impl TestRepo {let mut cmd = Command::new("git");self.configure_git_cmd(&mut cmd);- cmd.args(&args)- .current_dir(&self.root)- .output()- .expect("Failed to lock worktree");+ cmd.args(&args).current_dir(&self.root).output().unwrap();}/// Create a bare remote repository and set it as origin@@ -445,19 +434,17 @@ impl TestRepo {pub fn setup_custom_remote(&mut self, remote_name: &str, default_branch: &str) {// Create bare remote repositorylet remote_path = self.temp_dir.path().join(format!("{}.git", remote_name));- std::fs::create_dir(&remote_path).expect("Failed to create remote directory");+ std::fs::create_dir(&remote_path).unwrap();let mut cmd = Command::new("git");self.configure_git_cmd(&mut cmd);cmd.args(["init", "--bare", "--initial-branch", default_branch]).current_dir(&remote_path).output()- .expect("Failed to init bare remote");+ .unwrap();// Canonicalize remote path- let remote_path = remote_path- .canonicalize()- .expect("Failed to canonicalize remote path");+ let remote_path = remote_path.canonicalize().unwrap();// Add as remotelet mut cmd = Command::new("git");@@ -465,7 +452,7 @@ impl TestRepo {cmd.args(["remote", "add", remote_name, remote_path.to_str().unwrap()]).current_dir(&self.root).output()- .expect("Failed to add remote");+ .unwrap();// Push current branch to remotelet mut cmd = Command::new("git");@@ -473,7 +460,7 @@ impl TestRepo {cmd.args(["push", "-u", remote_name, default_branch]).current_dir(&self.root).output()- .expect("Failed to push to remote");+ .unwrap();// Set remote/HEAD to point to the default branchlet mut cmd = Command::new("git");@@ -496,7 +483,7 @@ impl TestRepo {cmd.args(["remote", "set-head", "origin", "--delete"]).current_dir(&self.root).output()- .expect("Failed to clear origin/HEAD");+ .unwrap();}/// Check if origin/HEAD is set@@ -507,7 +494,7 @@ impl TestRepo {.args(["rev-parse", "--abbrev-ref", "origin/HEAD"]).current_dir(&self.root).output()- .expect("Failed to check origin/HEAD");+ .unwrap();output.status.success()}@@ -534,7 +521,7 @@ impl TestRepo {.args(["branch", "--show-current"]).current_dir(&self.root).output()- .expect("Failed to get current branch");+ .unwrap();String::from_utf8_lossy(&output.stdout).trim().to_string()}@@ -551,7 +538,7 @@ impl TestRepo {/// This prevents CI detection from blocking tests with network calls.pub fn setup_mock_gh(&mut self) {let mock_bin = self.temp_dir.path().join("mock-bin");- std::fs::create_dir(&mock_bin).expect("Failed to create mock bin directory");+ std::fs::create_dir(&mock_bin).unwrap();// Create mock gh scriptlet gh_script = mock_bin.join("gh");@@ -576,14 +563,13 @@ case "$1" inesac"#,)- .expect("Failed to write mock gh script");+ .unwrap();// Make executable#[cfg(unix)]{use std::os::unix::fs::PermissionsExt;- std::fs::set_permissions(&gh_script, std::fs::Permissions::from_mode(0o755))- .expect("Failed to make gh script executable");+ std::fs::set_permissions(&gh_script, std::fs::Permissions::from_mode(0o755)).unwrap();}// Create mock glab script (fails immediately)@@ -595,13 +581,12 @@ esacexit 1"#,)- .expect("Failed to write mock glab script");+ .unwrap();#[cfg(unix)]{use std::os::unix::fs::PermissionsExt;- std::fs::set_permissions(&glab_script, std::fs::Permissions::from_mode(0o755))- .expect("Failed to make glab script executable");+ std::fs::set_permissions(&glab_script, std::fs::Permissions::from_mode(0o755)).unwrap();}self.mock_bin_path = Some(mock_bin);@@ -621,8 +606,7 @@ exit 1.map(|p| std::env::split_paths(p).collect()).unwrap_or_default();paths.insert(0, mock_bin.clone());- let new_path =- std::env::join_paths(paths).expect("Failed to join PATH components for tests");+ let new_path = std::env::join_paths(paths).unwrap();cmd.env("PATH", new_path);}}@@ -809,7 +793,7 @@ pub fn make_snapshot_cmd(/// The common git directory pathpub fn resolve_git_common_dir(worktree_path: &Path) -> PathBuf {let repo = worktrunk::git::Repository::at(worktree_path);- repo.git_common_dir().expect("Failed to get git common dir")+ repo.git_common_dir().unwrap()}/// Validates ANSI escape sequences for the specific nested reset pattern that causes color leaksdiff --git a/tests/common/progressive_output.rs b/tests/common/progressive_output.rsindex 0f9e14fc6..7a6441bbd 100644--- a/tests/common/progressive_output.rs+++ b/tests/common/progressive_output.rs@@ -42,7 +42,7 @@//! // Verify progressive filling behavior//! assert_eq!(output.exit_code, 0);//! assert!(output.stages.len() > 1, "Should capture multiple stages");-//! output.verify_progressive_filling().expect("Dots should decrease over time");+//! output.verify_progressive_filling().unwrap();//!//! // Verify header appears immediately//! assert!(output.initial().visible_text().contains("Branch"));@@ -72,7 +72,7 @@//!//! **Verify progressive data filling:**//! ```rust,ignore-//! output.verify_progressive_filling().expect("Dots should decrease");+//! output.verify_progressive_filling().unwrap();//! // Or manually://! let dots = output.dots_per_stage();//! assert!(dots[0] > dots[dots.len() - 1]);@@ -188,12 +188,12 @@ pub struct ProgressiveOutput {impl ProgressiveOutput {/// Get the initial snapshot (what appeared first)pub fn initial(&self) -> &OutputSnapshot {- self.stages.first().expect("No snapshots captured")+ self.stages.first().unwrap()}/// Get the final snapshot (complete output)pub fn final_snapshot(&self) -> &OutputSnapshot {- self.stages.last().expect("No snapshots captured")+ self.stages.last().unwrap()}/// Get the final visible text (convenience for final_snapshot().visible_text())@@ -206,7 +206,7 @@ impl ProgressiveOutput {self.stages.iter().min_by_key(|s| s.timestamp.abs_diff(target))- .expect("No snapshots captured")+ .unwrap()}/// Get snapshots at regular intervals (useful for showing progression)@@ -366,10 +366,7 @@ pub fn capture_progressive_output();// Read output and capture snapshots- let mut reader = pair- .master- .try_clone_reader()- .expect("Failed to clone PTY reader (master pseudo-terminal)");+ let mut reader = pair.master.try_clone_reader().unwrap();let mut snapshots = Vec::new();let mut last_snapshot_time = Instant::now();@@ -495,10 +492,7 @@ fn configure_pty_environment(cmd: &mut CommandBuilder, repo: &TestRepo) {// Basic environmentcmd.env("HOME",- home::home_dir()- .expect("HOME directory required")- .to_string_lossy()- .to_string(),+ home::home_dir().unwrap().to_string_lossy().to_string(),);cmd.env("PATH",diff --git a/tests/common/shell.rs b/tests/common/shell.rsindex 3b2a585bf..26e291c10 100644--- a/tests/common/shell.rs+++ b/tests/common/shell.rs@@ -15,7 +15,7 @@ use std::process::Command;/// being deleted after the lock is released. In practice, this is not an issue/// in the test environment.fn get_dev_detach_bin() -> PathBuf {- let manifest_dir = std::env::current_dir().expect("Failed to get current directory");+ let manifest_dir = std::env::current_dir().unwrap();let bin_path = manifest_dir.join("target/debug/dev-detach");// Lock file ensures only one process builds at a time@@ -41,7 +41,7 @@ fn get_dev_detach_bin() -> PathBuf {let status = Command::new("cargo").args(["build", "-p", "dev-detach", "--quiet"]).status()- .expect("Failed to execute cargo build");+ .unwrap();if !status.success() {panic!("Failed to build dev-detach binary");@@ -172,7 +172,7 @@ pub fn execute_shell_script(repo: &TestRepo, shell: &str, script: &str) -> Strin);}- String::from_utf8(output.stdout).expect("Invalid UTF-8 in output")+ String::from_utf8(output.stdout).unwrap()}/// Generate `wt config shell init <shell>` output for the repo.@@ -184,9 +184,9 @@ pub fn generate_init_code(repo: &TestRepo, shell: &str) -> String {.args(["config", "shell", "init", shell]).current_dir(repo.root_path()).output()- .expect("Failed to generate init code");+ .unwrap();- let stdout = String::from_utf8(output.stdout).expect("Invalid UTF-8 in init code");+ let stdout = String::from_utf8(output.stdout).unwrap();let stderr = String::from_utf8_lossy(&output.stderr);if !output.status.success() && stdout.trim().is_empty() {diff --git a/tests/helpers/dev-detach/src/setup-select-test.rs b/tests/helpers/dev-detach/src/setup-select-test.rsindex 4a0298e56..77a495494 100644--- a/tests/helpers/dev-detach/src/setup-select-test.rs+++ b/tests/helpers/dev-detach/src/setup-select-test.rs@@ -20,13 +20,13 @@ fn main() {// Create temp directory in /tmplet temp_base = std::env::temp_dir().join("wt-select-test");if temp_base.exists() {- fs::remove_dir_all(&temp_base).expect("Failed to clean old test directory");+ fs::remove_dir_all(&temp_base).unwrap();}- fs::create_dir(&temp_base).expect("Failed to create temp directory");+ fs::create_dir(&temp_base).unwrap();let root = temp_base.join("test-repo");- fs::create_dir(&root).expect("Failed to create repo directory");- let root = root.canonicalize().expect("Failed to canonicalize path");+ fs::create_dir(&root).unwrap();+ let root = root.canonicalize().unwrap();// Initialize git repogit(&root, &["init", "-b", "main"]);@@ -39,7 +39,7 @@ fn main() {root.join(format!("file{}.txt", i)),format!("content {}", i),)- .expect("Failed to write file");+ .unwrap();git(&root, &["add", "."]);git(&root, &["commit", "-m", &format!("Main commit {}", i)]);}@@ -52,7 +52,7 @@ fn main() {for line in 1..=100 {content.push_str(&format!("Line {} of feature file {}\n", line, i));}- fs::write(root.join(format!("feature{}.txt", i)), content).expect("Failed to write file");+ fs::write(root.join(format!("feature{}.txt", i)), content).unwrap();git(&root, &["add", "."]);git(&root,@@ -90,28 +90,26 @@ fn main() {// Add commits to this branch via its worktreefor j in 1..=*num_commits {let file_content = format!("Content for {} commit {}\n", branch_name, j);- fs::write(wt_path.join(format!("file{}.txt", j)), file_content)- .expect("Failed to write file");+ fs::write(wt_path.join(format!("file{}.txt", j)), file_content).unwrap();let mut cmd = Command::new("git");git_env(&mut cmd);cmd.args(["add", "."]).current_dir(&wt_path).output()- .expect("Failed to git add");+ .unwrap();let mut cmd = Command::new("git");git_env(&mut cmd);cmd.args(["commit", "-m", &format!("{} commit {}", branch_name, j)]).current_dir(&wt_path).output()- .expect("Failed to git commit");+ .unwrap();}}// Add uncommitted changes to feature worktree- let feature_wt = feature_wt.canonicalize().expect("Failed to canonicalize");- fs::write(feature_wt.join("uncommitted.txt"), "uncommitted changes")- .expect("Failed to write uncommitted file");+ let feature_wt = feature_wt.canonicalize().unwrap();+ fs::write(feature_wt.join("uncommitted.txt"), "uncommitted changes").unwrap();// Create some branches without worktreesgit(&root, &["branch", "no-worktree-1", "main"]);@@ -173,11 +171,7 @@ fn git_env(cmd: &mut Command) {fn git(repo: &PathBuf, args: &[&str]) {let mut cmd = Command::new("git");git_env(&mut cmd);- let output = cmd- .args(args)- .current_dir(repo)- .output()- .expect("Failed to execute git command");+ let output = cmd.args(args).current_dir(repo).output().unwrap();if !output.status.success() {eprintln!("Git command failed: git {}", args.join(" "));diff --git a/tests/helpers/setup-select-test/src/main.rs b/tests/helpers/setup-select-test/src/main.rsindex 4a0298e56..77a495494 100644--- a/tests/helpers/setup-select-test/src/main.rs+++ b/tests/helpers/setup-select-test/src/main.rs@@ -20,13 +20,13 @@ fn main() {// Create temp directory in /tmplet temp_base = std::env::temp_dir().join("wt-select-test");if temp_base.exists() {- fs::remove_dir_all(&temp_base).expect("Failed to clean old test directory");+ fs::remove_dir_all(&temp_base).unwrap();}- fs::create_dir(&temp_base).expect("Failed to create temp directory");+ fs::create_dir(&temp_base).unwrap();let root = temp_base.join("test-repo");- fs::create_dir(&root).expect("Failed to create repo directory");- let root = root.canonicalize().expect("Failed to canonicalize path");+ fs::create_dir(&root).unwrap();+ let root = root.canonicalize().unwrap();// Initialize git repogit(&root, &["init", "-b", "main"]);@@ -39,7 +39,7 @@ fn main() {root.join(format!("file{}.txt", i)),format!("content {}", i),)- .expect("Failed to write file");+ .unwrap();git(&root, &["add", "."]);git(&root, &["commit", "-m", &format!("Main commit {}", i)]);}@@ -52,7 +52,7 @@ fn main() {for line in 1..=100 {content.push_str(&format!("Line {} of feature file {}\n", line, i));}- fs::write(root.join(format!("feature{}.txt", i)), content).expect("Failed to write file");+ fs::write(root.join(format!("feature{}.txt", i)), content).unwrap();git(&root, &["add", "."]);git(&root,@@ -90,28 +90,26 @@ fn main() {// Add commits to this branch via its worktreefor j in 1..=*num_commits {let file_content = format!("Content for {} commit {}\n", branch_name, j);- fs::write(wt_path.join(format!("file{}.txt", j)), file_content)- .expect("Failed to write file");+ fs::write(wt_path.join(format!("file{}.txt", j)), file_content).unwrap();let mut cmd = Command::new("git");git_env(&mut cmd);cmd.args(["add", "."]).current_dir(&wt_path).output()- .expect("Failed to git add");+ .unwrap();let mut cmd = Command::new("git");git_env(&mut cmd);cmd.args(["commit", "-m", &format!("{} commit {}", branch_name, j)]).current_dir(&wt_path).output()- .expect("Failed to git commit");+ .unwrap();}}// Add uncommitted changes to feature worktree- let feature_wt = feature_wt.canonicalize().expect("Failed to canonicalize");- fs::write(feature_wt.join("uncommitted.txt"), "uncommitted changes")- .expect("Failed to write uncommitted file");+ let feature_wt = feature_wt.canonicalize().unwrap();+ fs::write(feature_wt.join("uncommitted.txt"), "uncommitted changes").unwrap();// Create some branches without worktreesgit(&root, &["branch", "no-worktree-1", "main"]);@@ -173,11 +171,7 @@ fn git_env(cmd: &mut Command) {fn git(repo: &PathBuf, args: &[&str]) {let mut cmd = Command::new("git");git_env(&mut cmd);- let output = cmd- .args(args)- .current_dir(repo)- .output()- .expect("Failed to execute git command");+ let output = cmd.args(args).current_dir(repo).output().unwrap();if !output.status.success() {eprintln!("Git command failed: git {}", args.join(" "));diff --git a/tests/integration_tests/approval_pty.rs b/tests/integration_tests/approval_pty.rsindex e05ce64a1..ea5962c15 100644--- a/tests/integration_tests/approval_pty.rs+++ b/tests/integration_tests/approval_pty.rs@@ -36,7 +36,7 @@ fn exec_in_pty_with_input(pixel_width: 0,pixel_height: 0,})- .expect("Failed to open PTY");+ .unwrap();// Spawn the command inside the PTYlet mut cmd = CommandBuilder::new(command);@@ -49,10 +49,7 @@ fn exec_in_pty_with_input(cmd.env_clear();cmd.env("HOME",- home::home_dir()- .expect("HOME directory required")- .to_string_lossy()- .to_string(),+ home::home_dir().unwrap().to_string_lossy().to_string(),);cmd.env("PATH",@@ -64,34 +61,24 @@ fn exec_in_pty_with_input(cmd.env(key, value);}- let mut child = pair- .slave- .spawn_command(cmd)- .expect("Failed to spawn command in PTY");+ let mut child = pair.slave.spawn_command(cmd).unwrap();drop(pair.slave); // Close slave in parent// Get reader and writer for the PTY master- let mut reader = pair- .master- .try_clone_reader()- .expect("Failed to clone PTY reader");- let mut writer = pair.master.take_writer().expect("Failed to get PTY writer");+ let mut reader = pair.master.try_clone_reader().unwrap();+ let mut writer = pair.master.take_writer().unwrap();// Write input to the PTY (simulating user typing)- writer- .write_all(input.as_bytes())- .expect("Failed to write input to PTY");- writer.flush().expect("Failed to flush PTY writer");+ writer.write_all(input.as_bytes()).unwrap();+ writer.flush().unwrap();drop(writer); // Close writer so command sees EOF// Read all outputlet mut buf = String::new();- reader- .read_to_string(&mut buf)- .expect("Failed to read PTY output");+ reader.read_to_string(&mut buf).unwrap();// Wait for child to exit- let exit_status = child.wait().expect("Failed to wait for child");+ let exit_status = child.wait().unwrap();let exit_code = exit_status.exit_code() as i32;(buf, exit_code)diff --git a/tests/integration_tests/approval_save.rs b/tests/integration_tests/approval_save.rsindex f28c89f96..d124165bc 100644--- a/tests/integration_tests/approval_save.rs+++ b/tests/integration_tests/approval_save.rs@@ -21,7 +21,7 @@ fn test_approval_saves_to_disk() {"test command".to_string(),Some(&config_path),)- .expect("Failed to save approval");+ .unwrap();// Verify the config was written to the isolated pathassert!(diff --git a/tests/integration_tests/approval_ui.rs b/tests/integration_tests/approval_ui.rsindex de6ca265b..6a8043dc2 100644--- a/tests/integration_tests/approval_ui.rs+++ b/tests/integration_tests/approval_ui.rs@@ -15,18 +15,16 @@ fn snapshot_approval(test_name: &str, repo: &TestRepo, args: &[&str], approve: b.stdout(Stdio::piped()).stderr(Stdio::piped());- let mut child = cmd.spawn().expect("Failed to spawn command");+ let mut child = cmd.spawn().unwrap();// Write approval response{- let stdin = child.stdin.as_mut().expect("Failed to get stdin");+ let stdin = child.stdin.as_mut().unwrap();let response = if approve { b"y\n" } else { b"n\n" };- stdin.write_all(response).expect("Failed to write to stdin");+ stdin.write_all(response).unwrap();}- let output = child- .wait_with_output()- .expect("Failed to wait for command");+ let output = child.wait_with_output().unwrap();// Use insta snapshot for combined outputlet stdout = String::from_utf8_lossy(&output.stdout);@@ -143,7 +141,7 @@ fn test_force_flag_does_not_save_approvals() {.arg("test-force").arg("--force").current_dir(repo.root_path());- cmd.output().expect("Failed to remove worktree");+ cmd.output().unwrap();// Run again WITHOUT --force - should promptsnapshot_approval(@@ -206,7 +204,7 @@ approved-commands = ["echo 'Second command'"]project_id),)- .expect("Failed to write test config");+ .unwrap();snapshot_approval("decline_approval_skips_only_unapproved",@@ -248,18 +246,16 @@ fn snapshot_run_hook(test_name: &str, repo: &TestRepo, hook_type: &str, approve:.stdout(Stdio::piped()).stderr(Stdio::piped());- let mut child = cmd.spawn().expect("Failed to spawn command");+ let mut child = cmd.spawn().unwrap();// Write approval response{- let stdin = child.stdin.as_mut().expect("Failed to get stdin");+ let stdin = child.stdin.as_mut().unwrap();let response = if approve { b"y\n" } else { b"n\n" };- stdin.write_all(response).expect("Failed to write to stdin");+ stdin.write_all(response).unwrap();}- let output = child- .wait_with_output()- .expect("Failed to wait for command");+ let output = child.wait_with_output().unwrap();// Use insta snapshot for combined outputlet stdout = String::from_utf8_lossy(&output.stdout);diff --git a/tests/integration_tests/approvals.rs b/tests/integration_tests/approvals.rsindex 13670a583..b149f660e 100644--- a/tests/integration_tests/approvals.rs+++ b/tests/integration_tests/approvals.rs@@ -94,7 +94,7 @@ fn test_clear_approvals_with_approvals() {"echo 'test'".to_string(),Some(repo.test_config_path()),)- .expect("Failed to save approval");+ .unwrap();// Now clear approvalssnapshot_clear_approvals("clear_approvals_with_approvals", &repo, &[]);@@ -124,7 +124,7 @@ fn test_clear_approvals_global_with_approvals() {"echo 'test'".to_string(),Some(repo.test_config_path()),)- .expect("Failed to save approval");+ .unwrap();// Now clear all global approvalssnapshot_clear_approvals(@@ -150,12 +150,12 @@ fn test_clear_approvals_after_clear() {"echo 'test'".to_string(),Some(repo.test_config_path()),)- .expect("Failed to save approval");+ .unwrap();// Clear approvalslet mut cmd = make_snapshot_cmd(&repo, "config", &[], None);cmd.arg("approvals").arg("clear");- cmd.output().expect("Failed to clear approvals");+ cmd.output().unwrap();// Try to clear again (should show "no approvals")snapshot_clear_approvals("clear_approvals_after_clear", &repo, &[]);@@ -184,21 +184,21 @@ lint = "echo 'third'""echo 'first'".to_string(),Some(repo.test_config_path()),)- .expect("Failed to save approval");+ .unwrap();config.approve_command_to(project_id.clone(),"echo 'second'".to_string(),Some(repo.test_config_path()),)- .expect("Failed to save approval");+ .unwrap();config.approve_command_to(project_id,"echo 'third'".to_string(),Some(repo.test_config_path()),)- .expect("Failed to save approval");+ .unwrap();// Now clear approvals (should show count of 3)snapshot_clear_approvals("clear_approvals_multiple_approvals", &repo, &[]);diff --git a/tests/integration_tests/bare_repository.rs b/tests/integration_tests/bare_repository.rsindex 7bdebb8d5..b1ce11b40 100644--- a/tests/integration_tests/bare_repository.rs+++ b/tests/integration_tests/bare_repository.rs@@ -13,7 +13,7 @@ struct BareRepoTest {impl BareRepoTest {fn new() -> Self {- let temp_dir = tempfile::TempDir::new().expect("Failed to create temp directory");+ let temp_dir = tempfile::TempDir::new().unwrap();let bare_repo_path = temp_dir.path().join("test-repo.git");let test_config_path = temp_dir.path().join("test-config.toml");@@ -31,7 +31,7 @@ impl BareRepoTest {.env("GIT_CONFIG_GLOBAL", "/dev/null").env("GIT_CONFIG_SYSTEM", "/dev/null").output()- .expect("Failed to create bare repo");+ .unwrap();if !output.status.success() {panic!(@@ -42,10 +42,7 @@ impl BareRepoTest {}// Canonicalize path- test.bare_repo_path = test- .bare_repo_path- .canonicalize()- .expect("Failed to canonicalize bare repo path");+ test.bare_repo_path = test.bare_repo_path.canonicalize().unwrap();test}@@ -81,7 +78,7 @@ impl BareRepoTest {.env("GIT_AUTHOR_DATE", "2025-01-01T00:00:00Z").env("GIT_COMMITTER_DATE", "2025-01-01T00:00:00Z");- let output = cmd.output().expect("Failed to create worktree");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(@@ -91,16 +88,14 @@ impl BareRepoTest {);}- worktree_path- .canonicalize()- .expect("Failed to canonicalize worktree path")+ worktree_path.canonicalize().unwrap()}/// Create a commit in the specified worktreefn commit_in_worktree(&self, worktree_path: &PathBuf, message: &str) {// Create a filelet file_path = worktree_path.join("file.txt");- fs::write(&file_path, message).expect("Failed to write file");+ fs::write(&file_path, message).unwrap();// Add filelet output = Command::new("git")@@ -109,7 +104,7 @@ impl BareRepoTest {.env("GIT_CONFIG_GLOBAL", "/dev/null").env("GIT_CONFIG_SYSTEM", "/dev/null").output()- .expect("Failed to add file");+ .unwrap();if !output.status.success() {panic!(@@ -132,7 +127,7 @@ impl BareRepoTest {.env("GIT_COMMITTER_EMAIL", "[email protected]").env("GIT_COMMITTER_DATE", "2025-01-01T00:00:00Z").output()- .expect("Failed to commit");+ .unwrap();if !output.status.success() {panic!(@@ -194,7 +189,7 @@ fn test_bare_repo_list_shows_no_bare_entry() {test.configure_wt_cmd(&mut cmd);cmd.arg("list").current_dir(&main_worktree);- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stderr = String::from_utf8_lossy(&output.stderr);// Should only show the main worktree, not the bare repo (table output is on stderr)@@ -220,7 +215,7 @@ fn test_bare_repo_switch_creates_worktree() {cmd.args(["switch", "--create", "feature", "--internal"]).current_dir(&main_worktree);- let output = cmd.output().expect("Failed to run wt switch");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(@@ -240,7 +235,7 @@ fn test_bare_repo_switch_creates_worktree() {]).env("GIT_CONFIG_GLOBAL", "/dev/null").output()- .expect("Failed to list worktrees");+ .unwrap();eprintln!("Git worktree list:\n{}",@@ -269,7 +264,7 @@ fn test_bare_repo_switch_creates_worktree() {.env("GIT_CONFIG_GLOBAL", "/dev/null").env("GIT_CONFIG_SYSTEM", "/dev/null");- let output = cmd.output().expect("Failed to run git worktree list");+ let output = cmd.output().unwrap();let stdout = String::from_utf8_lossy(&output.stdout);// Should show 3 entries: bare repo + 2 worktrees@@ -291,7 +286,7 @@ fn test_bare_repo_switch_with_default_naming() {cmd.args(["switch", "--create", "feature", "--internal"]).current_dir(&main_worktree);- let output = cmd.output().expect("Failed to run wt switch");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(@@ -328,7 +323,7 @@ fn test_bare_repo_remove_worktree() {cmd.args(["remove", "feature", "--no-background", "--internal"]).current_dir(&main_worktree);- let output = cmd.output().expect("Failed to run wt remove");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(@@ -364,7 +359,7 @@ fn test_bare_repo_identifies_primary_correctly() {test.configure_wt_cmd(&mut cmd);cmd.arg("list").current_dir(&main_worktree);- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stderr = String::from_utf8_lossy(&output.stderr);// First non-bare worktree (main) should be primary (table output is on stderr)@@ -389,7 +384,7 @@ fn test_bare_repo_worktree_base_used_for_paths() {cmd.args(["switch", "--create", "dev", "--internal"]).current_dir(&main_worktree);- cmd.output().expect("Failed to run wt switch");+ cmd.output().unwrap();// Verify path is created as sibling to bare repo (using worktree_base)// Default template: ../{{ main_worktree }}.{{ branch }} -> test-repo.git.dev@@ -427,8 +422,8 @@ fn test_bare_repo_equivalent_to_normal_repo() {let config = r#"worktree-path = "{{ branch }}""#;- fs::write(bare_test.config_path(), config).expect("Failed to write bare config");- fs::write(normal_test.test_config_path(), config).expect("Failed to write normal config");+ fs::write(bare_test.config_path(), config).unwrap();+ fs::write(normal_test.test_config_path(), config).unwrap();// List worktrees in both - should show similar structurelet mut bare_list = wt_command();@@ -439,10 +434,8 @@ worktree-path = "{{ branch }}"normal_test.clean_cli_env(&mut normal_list);normal_list.arg("list").current_dir(normal_test.root_path());- let bare_output = bare_list.output().expect("Failed to list bare worktrees");- let normal_output = normal_list- .output()- .expect("Failed to list normal worktrees");+ let bare_output = bare_list.output().unwrap();+ let normal_output = normal_list.output().unwrap();// Both should show 1 worktree (main/main) - table output is on stderrlet bare_stderr = String::from_utf8_lossy(&bare_output.stderr);@@ -466,7 +459,7 @@ fn test_bare_repo_commands_from_bare_directory() {test.configure_wt_cmd(&mut cmd);cmd.arg("list").current_dir(test.bare_repo_path());- let output = cmd.output().expect("Failed to run wt list from bare repo");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(@@ -499,7 +492,7 @@ fn test_bare_repo_merge_workflow() {test.configure_wt_cmd(&mut cmd);cmd.args(["switch", "--create", "feature", "--internal"]).current_dir(&main_worktree);- cmd.output().expect("Failed to create feature worktree");+ cmd.output().unwrap();// Get feature worktree path (default template: ../{{ main_worktree }}.{{ branch }})let bare_name = test.bare_repo_path().file_name().unwrap().to_str().unwrap();@@ -521,7 +514,7 @@ fn test_bare_repo_merge_workflow() {]).current_dir(&feature_worktree);- let output = cmd.output().expect("Failed to run wt merge");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(@@ -551,7 +544,7 @@ fn test_bare_repo_merge_workflow() {.args(["-C", main_worktree.to_str().unwrap(), "log", "--oneline"]).env("GIT_CONFIG_GLOBAL", "/dev/null").output()- .expect("Failed to get git log");+ .unwrap();let log = String::from_utf8_lossy(&log_output.stdout);assert!(@@ -581,7 +574,7 @@ fn test_bare_repo_background_logs_location() {cmd.args(["remove", "feature", "--internal"]).current_dir(&main_worktree);- let output = cmd.output().expect("Failed to run wt remove");+ let output = cmd.output().unwrap();if !output.status.success() {panic!(diff --git a/tests/integration_tests/column_alignment_verification.rs b/tests/integration_tests/column_alignment_verification.rsindex 46758b31e..6a64c7e4b 100644--- a/tests/integration_tests/column_alignment_verification.rs+++ b/tests/integration_tests/column_alignment_verification.rs@@ -332,7 +332,7 @@ fn test_alignment_verification_with_varying_content() {repo.clean_cli_env(&mut cmd);cmd.arg("list").current_dir(repo.root_path());- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stdout = String::from_utf8_lossy(&output.stderr);println!("=== RAW OUTPUT ===");@@ -361,7 +361,7 @@ fn test_alignment_with_unicode_content() {repo.clean_cli_env(&mut cmd);cmd.arg("list").current_dir(repo.root_path());- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stdout = String::from_utf8_lossy(&output.stderr);println!("=== RAW OUTPUT WITH UNICODE ===");@@ -400,7 +400,7 @@ fn test_alignment_with_sparse_columns() {repo.clean_cli_env(&mut cmd);cmd.arg("list").current_dir(repo.root_path());- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stdout = String::from_utf8_lossy(&output.stderr);println!("=== RAW OUTPUT WITH SPARSE COLUMNS ===");@@ -451,7 +451,7 @@ fn test_alignment_real_world_scenario() {repo.clean_cli_env(&mut cmd);cmd.arg("list").current_dir(repo.root_path());- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stdout = String::from_utf8_lossy(&output.stderr);println!("=== RAW OUTPUT: Real World Scenario ===");@@ -486,7 +486,7 @@ fn test_alignment_at_different_terminal_widths() {.current_dir(repo.root_path()).env("COLUMNS", width.to_string());- let output = cmd.output().expect("Failed to run wt list");+ let output = cmd.output().unwrap();let stdout = String::from_utf8_lossy(&output.stderr);println!("{}", stdout);diff --git a/tests/integration_tests/completion_validation.rs b/tests/integration_tests/completion_validation.rsindex 5cfa1bac0..6e1c22712 100644--- a/tests/integration_tests/completion_validation.rs+++ b/tests/integration_tests/completion_validation.rs@@ -245,7 +245,7 @@ fn test_completion_validation() {.arg("init").arg("fish").output()- .expect("Failed to generate fish completion");+ .unwrap();let bash_output = wt_command().arg("config")@@ -253,7 +253,7 @@ fn test_completion_validation() {.arg("init").arg("bash").output()- .expect("Failed to generate bash completion");+ .unwrap();let zsh_output = wt_command().arg("config")@@ -261,7 +261,7 @@ fn test_completion_validation() {.arg("init").arg("zsh").output()- .expect("Failed to generate zsh completion");+ .unwrap();assert!(fish_output.status.success());assert!(bash_output.status.success());diff --git a/tests/integration_tests/default_branch.rs b/tests/integration_tests/default_branch.rsindex 1b2e8696e..73ccd2b39 100644--- a/tests/integration_tests/default_branch.rs+++ b/tests/integration_tests/default_branch.rs@@ -11,9 +11,7 @@ fn test_get_default_branch_with_origin_head() {assert!(repo.has_origin_head());// Test that we can get the default branch- let branch = Repository::at(repo.root_path())- .default_branch()- .expect("Failed to get default branch");+ let branch = Repository::at(repo.root_path()).default_branch().unwrap();assert_eq!(branch, "main");}@@ -28,9 +26,7 @@ fn test_get_default_branch_without_origin_head() {assert!(!repo.has_origin_head());// Should still work by querying remote- let branch = Repository::at(repo.root_path())- .default_branch()- .expect("Failed to get default branch");+ let branch = Repository::at(repo.root_path()).default_branch().unwrap();assert_eq!(branch, "main");// Verify that origin/HEAD is now cached@@ -48,15 +44,11 @@ fn test_get_default_branch_caches_result() {assert!(!repo.has_origin_head());// First call queries remote and caches- Repository::at(repo.root_path())- .default_branch()- .expect("Failed to get default branch");+ Repository::at(repo.root_path()).default_branch().unwrap();assert!(repo.has_origin_head());// Second call uses cache (fast path)- let branch = Repository::at(repo.root_path())- .default_branch()- .expect("Failed to get default branch on second call");+ let branch = Repository::at(repo.root_path()).default_branch().unwrap();assert_eq!(branch, "main");}@@ -74,8 +66,8 @@ fn test_get_default_branch_no_remote() {let inferred_branch = result.unwrap();let current_branch = Repository::at(repo.root_path()).current_branch()- .expect("Failed to get current branch")- .expect("Should have a current branch");+ .unwrap()+ .unwrap();assert_eq!(inferred_branch, current_branch);}@@ -86,9 +78,7 @@ fn test_get_default_branch_with_custom_remote() {repo.setup_custom_remote("upstream", "main");// Test that we can get the default branch from a custom remote- let branch = Repository::at(repo.root_path())- .default_branch()- .expect("Failed to get default branch");+ let branch = Repository::at(repo.root_path()).default_branch().unwrap();assert_eq!(branch, "main");}@@ -99,9 +89,7 @@ fn test_primary_remote_detects_custom_remote() {repo.setup_custom_remote("upstream", "develop");// Test that primary_remote detects the custom remote name- let remote = Repository::at(repo.root_path())- .primary_remote()- .expect("Failed to get primary remote");+ let remote = Repository::at(repo.root_path()).primary_remote().unwrap();assert_eq!(remote, "upstream");}@@ -114,16 +102,8 @@ fn test_branch_exists_with_custom_remote() {let git_repo = Repository::at(repo.root_path());// Should find the branch on the custom remote- assert!(- git_repo- .branch_exists("main")- .expect("Failed to check branch")- );+ assert!(git_repo.branch_exists("main").unwrap());// Should not find non-existent branch- assert!(- !git_repo- .branch_exists("nonexistent")- .expect("Failed to check branch")- );+ assert!(!git_repo.branch_exists("nonexistent").unwrap());}diff --git a/tests/integration_tests/directives.rs b/tests/integration_tests/directives.rsindex ad3f7293f..278585947 100644--- a/tests/integration_tests/directives.rs+++ b/tests/integration_tests/directives.rs@@ -133,26 +133,25 @@ fn test_merge_internal_no_remove() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();let mut settings = setup_snapshot_settings(&repo);// Normalize SHA in output@@ -188,26 +187,25 @@ fn test_merge_internal_remove() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();let mut settings = setup_snapshot_settings(&repo);// Normalize SHA and path in outputdiff --git a/tests/integration_tests/e2e_shell.rs b/tests/integration_tests/e2e_shell.rsindex 3cb04add8..189acbdf3 100644--- a/tests/integration_tests/e2e_shell.rs+++ b/tests/integration_tests/e2e_shell.rs@@ -46,10 +46,8 @@ fn test_shell_integration_switch_and_remove(#[case] shell: &str) {output);- let after_switch =- extract_pwd_marker(&output, "__PWD_AFTER_SWITCH__").expect("Missing switch marker");- let after_remove =- extract_pwd_marker(&output, "__PWD_AFTER_REMOVE__").expect("Missing remove marker");+ let after_switch = extract_pwd_marker(&output, "__PWD_AFTER_SWITCH__").unwrap();+ let after_remove = extract_pwd_marker(&output, "__PWD_AFTER_REMOVE__").unwrap();assert!(after_switch.contains("combo-branch"),@@ -133,10 +131,8 @@ fn test_bash_shell_integration_switch_existing_worktree() {);let output = execute_shell_script(&repo, "bash", &script);- let after_create =- extract_pwd_marker(&output, "__AFTER_CREATE__").expect("missing create marker");- let after_existing =- extract_pwd_marker(&output, "__AFTER_EXISTING__").expect("missing existing marker");+ let after_create = extract_pwd_marker(&output, "__AFTER_CREATE__").unwrap();+ let after_existing = extract_pwd_marker(&output, "__AFTER_EXISTING__").unwrap();assert!(after_create.contains("existing-branch"),diff --git a/tests/integration_tests/e2e_shell_post_start.rs b/tests/integration_tests/e2e_shell_post_start.rsindex a12e06ca1..4a5071c22 100644--- a/tests/integration_tests/e2e_shell_post_start.rs+++ b/tests/integration_tests/e2e_shell_post_start.rs@@ -33,12 +33,12 @@ fn test_shell_integration_post_start_background(#[case] shell: &str) {// Create project config with background commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "sleep 0.05 && echo 'Background task done' > bg_marker.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add post-start config");@@ -51,7 +51,7 @@ fn test_shell_integration_post_start_background(#[case] shell: &str) {approved-commands = ["sleep 0.05 && echo 'Background task done' > bg_marker.txt"]"#,)- .expect("Failed to write user config");+ .unwrap();let init_code = generate_init_code(&repo, shell);let bin_path = wt_bin_dir();@@ -98,7 +98,7 @@ approved-commands = ["sleep 0.05 && echo 'Background task done' > bg_marker.txt"// Check for log fileslet log_files: Vec<_> = fs::read_dir(&log_dir)- .expect("Failed to read log dir")+ .unwrap().filter_map(|e| e.ok()).map(|e| e.file_name().to_string_lossy().to_string()).collect();@@ -117,7 +117,7 @@ approved-commands = ["sleep 0.05 && echo 'Background task done' > bg_marker.txt");let marker_file = worktree_path.join("bg_marker.txt");- let content = fs::read_to_string(&marker_file).expect("Failed to read marker file");+ let content = fs::read_to_string(&marker_file).unwrap();assert!(content.contains("Background task done"),"Expected background task output, got: {}",@@ -133,7 +133,7 @@ fn test_bash_shell_integration_post_start_parallel() {// Create project config with multiple background commandslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"[post-start-command]@@ -141,7 +141,7 @@ task1 = "sleep 0.05 && echo 'Task 1' > task1.txt"task2 = "sleep 0.05 && echo 'Task 2' > task2.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add multiple post-start commands");@@ -157,7 +157,7 @@ approved-commands = []"#,)- .expect("Failed to write test config");+ .unwrap();let init_code = generate_init_code(&repo, "bash");let bin_path = wt_bin_dir();@@ -206,12 +206,12 @@ fn test_bash_shell_integration_post_create_blocks() {// Create project config with blocking commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-create-command = "echo 'Setup done' > setup.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add post-create command");@@ -224,7 +224,7 @@ fn test_bash_shell_integration_post_create_blocks() {approved-commands = ["echo 'Setup done' > setup.txt"]"#,)- .expect("Failed to write test config");+ .unwrap();let init_code = generate_init_code(&repo, "bash");let bin_path = wt_bin_dir();@@ -261,7 +261,7 @@ approved-commands = ["echo 'Setup done' > setup.txt"]"Setup file should exist immediately after wt returns (post-create is blocking)");- let content = fs::read_to_string(&setup_file).expect("Failed to read setup file");+ let content = fs::read_to_string(&setup_file).unwrap();assert!(content.contains("Setup done"),"Expected setup output, got: {}",@@ -278,14 +278,14 @@ fn test_fish_shell_integration_post_start_background() {// Create project config with background commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"[post-start-command]fish_bg = "sleep 0.05 && echo 'Fish background done' > fish_bg.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add fish background command");@@ -298,7 +298,7 @@ fish_bg = "sleep 0.05 && echo 'Fish background done' > fish_bg.txt"approved-commands = ["sleep 0.05 && echo 'Fish background done' > fish_bg.txt"]"#,)- .expect("Failed to write test config");+ .unwrap();let init_code = generate_init_code(&repo, "fish");let bin_path = wt_bin_dir();@@ -346,7 +346,7 @@ approved-commands = ["sleep 0.05 && echo 'Fish background done' > fish_bg.txt"]"Fish background command should have created fish_bg.txt");- let content = fs::read_to_string(&marker_file).expect("Failed to read marker file");+ let content = fs::read_to_string(&marker_file).unwrap();assert!(content.contains("Fish background done"),"Expected fish background output, got: {}",diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rsindex 4579b9e1a..22bde1a2e 100644--- a/tests/integration_tests/list.rs+++ b/tests/integration_tests/list.rs@@ -120,16 +120,13 @@ fn setup_timestamped_worktrees(repo: &mut TestRepo) -> std::path::PathBuf {&file_path,format!("{} content", filename.trim_end_matches(".txt")),)- .expect("Failed to write file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.env("GIT_AUTHOR_DATE", time);cmd.env("GIT_COMMITTER_DATE", time);- cmd.args(["add", "."])- .current_dir(path)- .output()- .expect("Failed to git add");+ cmd.args(["add", "."]).current_dir(path).output().unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);@@ -138,7 +135,7 @@ fn setup_timestamped_worktrees(repo: &mut TestRepo) -> std::path::PathBuf {cmd.args(["commit", "-m", &format!("Commit at {}", time_short)]).current_dir(path).output()- .expect("Failed to git commit");+ .unwrap();}// 1. Create feature-current (01:00) - we'll run test from here@@ -191,7 +188,7 @@ fn create_branch(repo: &TestRepo, branch_name: &str) {cmd.args(["branch", branch_name]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();}/// Helper to push a branch to origin (creating a remote branch)@@ -201,7 +198,7 @@ fn push_branch(repo: &TestRepo, branch_name: &str) {cmd.args(["push", "origin", branch_name]).current_dir(repo.root_path()).output()- .expect("Failed to push branch to origin");+ .unwrap();}#[test]@@ -381,7 +378,7 @@ fn test_list_with_remotes_flag() {cmd.args(["branch", "-D", "remote-feature-1", "remote-feature-2"]).current_dir(repo.root_path()).output()- .expect("Failed to delete local branches");+ .unwrap();// Should show:// - main worktree (primary)@@ -411,7 +408,7 @@ fn test_list_with_remotes_and_branches() {cmd.args(["branch", "-D", "remote-only-1", "remote-only-2"]).current_dir(repo.root_path()).output()- .expect("Failed to delete branches");+ .unwrap();// Should show:// - main worktree@@ -440,7 +437,7 @@ fn test_list_with_remotes_filters_existing_worktrees() {cmd.args(["branch", "-D", "remote-only"]).current_dir(repo.root_path()).output()- .expect("Failed to delete branch");+ .unwrap();// Should show:// - main worktree@@ -460,35 +457,32 @@ fn test_list_json_with_display_fields() {// Make commits in the feature worktreelet feature_path = repo.worktree_path("feature-ahead");- std::fs::write(feature_path.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_path.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(feature_path).output()- .expect("Failed to git add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Feature commit 1"]).current_dir(feature_path).output()- .expect("Failed to commit");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "--allow-empty", "-m", "Feature commit 2"]).current_dir(feature_path).output()- .expect("Failed to commit");+ .unwrap();// Add uncommitted changes to show working_diff_display- std::fs::write(feature_path.join("uncommitted.txt"), "uncommitted")- .expect("Failed to write file");- std::fs::write(feature_path.join("feature.txt"), "modified content")- .expect("Failed to write file");+ std::fs::write(feature_path.join("uncommitted.txt"), "uncommitted").unwrap();+ std::fs::write(feature_path.join("feature.txt"), "modified content").unwrap();// Create another feature that will be behind after main advancesrepo.add_worktree("feature-behind", "feature-behind");@@ -527,7 +521,7 @@ fn test_list_with_upstream_tracking() {cmd.args(["push", "-u", "origin", "in-sync"]).current_dir(&in_sync_wt).output()- .expect("Failed to push in-sync");+ .unwrap();// Scenario 2: Branch ahead of remote (should show ↑2)let ahead_wt = repo.add_worktree("ahead", "ahead");@@ -536,107 +530,107 @@ fn test_list_with_upstream_tracking() {cmd.args(["push", "-u", "origin", "ahead"]).current_dir(&ahead_wt).output()- .expect("Failed to push ahead");+ .unwrap();// Make 2 commits ahead- std::fs::write(ahead_wt.join("ahead1.txt"), "ahead 1").expect("Failed to write");+ std::fs::write(ahead_wt.join("ahead1.txt"), "ahead 1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&ahead_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Ahead commit 1"]).current_dir(&ahead_wt).output()- .expect("Failed to commit");+ .unwrap();- std::fs::write(ahead_wt.join("ahead2.txt"), "ahead 2").expect("Failed to write");+ std::fs::write(ahead_wt.join("ahead2.txt"), "ahead 2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&ahead_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Ahead commit 2"]).current_dir(&ahead_wt).output()- .expect("Failed to commit");+ .unwrap();// Scenario 3: Branch behind remote (should show ↓1)let behind_wt = repo.add_worktree("behind", "behind");- std::fs::write(behind_wt.join("behind.txt"), "behind").expect("Failed to write");+ std::fs::write(behind_wt.join("behind.txt"), "behind").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&behind_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Behind commit"]).current_dir(&behind_wt).output()- .expect("Failed to commit");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["push", "-u", "origin", "behind"]).current_dir(&behind_wt).output()- .expect("Failed to push");+ .unwrap();// Reset local to one commit behindlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["reset", "--hard", "HEAD~1"]).current_dir(&behind_wt).output()- .expect("Failed to reset");+ .unwrap();// Scenario 4: Branch both ahead and behind (should show ↑1 ↓1)let diverged_wt = repo.add_worktree("diverged", "diverged");- std::fs::write(diverged_wt.join("diverged.txt"), "diverged").expect("Failed to write");+ std::fs::write(diverged_wt.join("diverged.txt"), "diverged").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&diverged_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Diverged remote commit"]).current_dir(&diverged_wt).output()- .expect("Failed to commit");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["push", "-u", "origin", "diverged"]).current_dir(&diverged_wt).output()- .expect("Failed to push");+ .unwrap();// Reset and make different commitlet mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["reset", "--hard", "HEAD~1"]).current_dir(&diverged_wt).output()- .expect("Failed to reset");- std::fs::write(diverged_wt.join("different.txt"), "different").expect("Failed to write");+ .unwrap();+ std::fs::write(diverged_wt.join("different.txt"), "different").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&diverged_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Diverged local commit"]).current_dir(&diverged_wt).output()- .expect("Failed to commit");+ .unwrap();// Scenario 5: Branch without upstream (should show blank)repo.add_worktree("no-upstream", "no-upstream");@@ -688,7 +682,7 @@ fn test_list_with_user_status() {cmd.args(["config", "worktrunk.status.clean-with-status", "💬"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();// Worktree with both git status and user statuslet dirty_wt = repo.add_worktree("dirty-with-status", "dirty-with-status");@@ -699,14 +693,14 @@ fn test_list_with_user_status() {cmd.args(["config", "worktrunk.status.dirty-with-status", "🤖"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();// Add uncommitted changes- std::fs::write(dirty_wt.join("new.txt"), "content").expect("Failed to write file");+ std::fs::write(dirty_wt.join("new.txt"), "content").unwrap();// Worktree with git status only (no user status)let dirty_no_status_wt = repo.add_worktree("dirty-no-status", "dirty-no-status");- std::fs::write(dirty_no_status_wt.join("file.txt"), "content").expect("Failed to write file");+ std::fs::write(dirty_no_status_wt.join("file.txt"), "content").unwrap();// Worktree with neither (control)repo.add_worktree("clean-no-status", "clean-no-status");@@ -728,7 +722,7 @@ fn test_list_json_with_user_status() {cmd.args(["config", "worktrunk.status.with-status", "🔧"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();// Worktree without user statusrepo.add_worktree("without-status", "without-status");@@ -748,7 +742,7 @@ fn test_list_branch_only_with_status() {cmd.args(["branch", "branch-only"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();// Set branch-keyed status for the branch-only entrylet mut cmd = Command::new("git");@@ -756,7 +750,7 @@ fn test_list_branch_only_with_status() {cmd.args(["config", "worktrunk.status.branch-only", "🌿"]).current_dir(repo.root_path()).output()- .expect("Failed to set branch status");+ .unwrap();// Use --branches flag to show branch-only entriessnapshot_list_with_branches("branch_only_with_status", &repo);@@ -775,7 +769,7 @@ fn test_list_user_status_with_special_characters() {cmd.args(["config", "worktrunk.status.emoji", "🔄"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();// Test with compound emoji (multi-codepoint)repo.add_worktree("multi", "multi");@@ -785,7 +779,7 @@ fn test_list_user_status_with_special_characters() {cmd.args(["config", "worktrunk.status.multi", "👨💻"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();snapshot_list("user_status_special_chars", &repo);}@@ -810,47 +804,47 @@ fn test_readme_example_simple_list() {feature_x.join(format!("file{}.txt", i)),format!("content {}", i),)- .expect("Failed to write file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", &format!("file{}.txt", i)]).current_dir(&feature_x).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", &format!("Add file {}", i)]).current_dir(&feature_x).output()- .expect("Failed to commit");+ .unwrap();}// Add unstaged changes (+5 -2 lines)std::fs::write(feature_x.join("modified.txt"),"line1\nline2\nline3\nline4\nline5\n",)- .expect("Failed to write");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "modified.txt"]).current_dir(&feature_x).output()- .expect("Failed to add");+ .unwrap();// bugfix-y: 1 commit ahead, clean tree- std::fs::write(bugfix_y.join("bugfix.txt"), "fix content").expect("Failed to write file");+ std::fs::write(bugfix_y.join("bugfix.txt"), "fix content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "bugfix.txt"]).current_dir(&bugfix_y).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Fix bug"]).current_dir(&bugfix_y).output()- .expect("Failed to commit");+ .unwrap();snapshot_list("readme_example_simple_list", &repo);}@@ -925,23 +919,23 @@ fn test_list_task_dag_full_with_diffs() {// Create worktree with changeslet feature_a = repo.add_worktree("feature-a", "feature-a");- std::fs::write(feature_a.join("new.txt"), "content").expect("Failed to write file");+ std::fs::write(feature_a.join("new.txt"), "content").unwrap();// Create another worktree with commitslet feature_b = repo.add_worktree("feature-b", "feature-b");- std::fs::write(feature_b.join("file.txt"), "test").expect("Failed to write file");+ std::fs::write(feature_b.join("file.txt"), "test").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&feature_b).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Test commit"]).current_dir(&feature_b).output()- .expect("Failed to commit");+ .unwrap();snapshot_list_task_dag_full("task_dag_full_with_diffs", &repo);}@@ -959,7 +953,7 @@ fn test_list_task_dag_with_upstream() {cmd.args(["push", "-u", "origin", "in-sync"]).current_dir(&in_sync).output()- .expect("Failed to push");+ .unwrap();// Branch aheadlet ahead = repo.add_worktree("ahead", "ahead");@@ -968,20 +962,17 @@ fn test_list_task_dag_with_upstream() {cmd.args(["push", "-u", "origin", "ahead"]).current_dir(&ahead).output()- .expect("Failed to push");- std::fs::write(ahead.join("ahead.txt"), "ahead").expect("Failed to write");+ .unwrap();+ std::fs::write(ahead.join("ahead.txt"), "ahead").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);- cmd.args(["add", "."])- .current_dir(&ahead)- .output()- .expect("Failed to add");+ cmd.args(["add", "."]).current_dir(&ahead).output().unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Ahead commit"]).current_dir(&ahead).output()- .expect("Failed to commit");+ .unwrap();snapshot_list_task_dag_full("task_dag_with_upstream", &repo);}@@ -1061,11 +1052,11 @@ fn test_list_progressive_vs_buffered_identical_data() {// Run both modes with JSON output to compare data (not formatting)let progressive_output = list_snapshots::command_progressive_json(&repo).output()- .expect("Progressive JSON command failed");+ .unwrap();let buffered_output = list_snapshots::command_no_progressive_json(&repo).output()- .expect("Buffered JSON command failed");+ .unwrap();// Both should succeedassert!(@@ -1080,10 +1071,9 @@ fn test_list_progressive_vs_buffered_identical_data() {);// Parse JSON outputs- let progressive_json: serde_json::Value = serde_json::from_slice(&progressive_output.stdout)- .expect("Invalid JSON from progressive mode");- let buffered_json: serde_json::Value =- serde_json::from_slice(&buffered_output.stdout).expect("Invalid JSON from buffered mode");+ let progressive_json: serde_json::Value =+ serde_json::from_slice(&progressive_output.stdout).unwrap();+ let buffered_json: serde_json::Value = serde_json::from_slice(&buffered_output.stdout).unwrap();// The JSON data should be identical (ignoring display fields which may have formatting differences)// Compare the structured data to ensure both modes collect the same information@@ -1114,7 +1104,7 @@ fn test_list_error_shows_worktree_context() {// Delete the worktree directory manually to trigger an error// (but keep the git metadata, so git worktree list still shows it)- std::fs::remove_dir_all(&feature_wt).expect("Failed to remove worktree directory");+ std::fs::remove_dir_all(&feature_wt).unwrap();// Run list command and expect an errorlet mut cmd = wt_command();@@ -1122,7 +1112,7 @@ fn test_list_error_shows_worktree_context() {repo.configure_mock_commands(&mut cmd);cmd.arg("list").current_dir(repo.root_path());- let output = cmd.output().expect("Failed to run command");+ let output = cmd.output().unwrap();// Should fail with non-zero exit codelet stdout = String::from_utf8_lossy(&output.stdout);@@ -1182,7 +1172,7 @@ fn test_list_large_diffs_alignment() {.map(|i| format!("line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(large_wt.join("large.txt"), &large_content).expect("Failed to write file");+ std::fs::write(large_wt.join("large.txt"), &large_content).unwrap();// Commit itlet mut cmd = Command::new("git");@@ -1190,31 +1180,31 @@ fn test_list_large_diffs_alignment() {cmd.args(["add", "."]).current_dir(&large_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add 100 lines"]).current_dir(&large_wt).output()- .expect("Failed to commit");+ .unwrap();// Add large uncommitted changes (both added and deleted lines)// Add a new file with many lines- std::fs::write(large_wt.join("uncommitted.txt"), &large_content).expect("Failed to write file");+ std::fs::write(large_wt.join("uncommitted.txt"), &large_content).unwrap();// Modify the existing file to create deletionslet modified_content = (1..=50).map(|i| format!("modified line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(large_wt.join("large.txt"), &modified_content).expect("Failed to write file");+ std::fs::write(large_wt.join("large.txt"), &modified_content).unwrap();// Add another new file with many lineslet another_large = (1..=80).map(|i| format!("another line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(large_wt.join("another.txt"), &another_large).expect("Failed to write file");+ std::fs::write(large_wt.join("another.txt"), &another_large).unwrap();// Set user statuslet mut cmd = Command::new("git");@@ -1222,11 +1212,11 @@ fn test_list_large_diffs_alignment() {cmd.args(["config", "worktrunk.status.feature-changes", "🤖"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();// Worktree with short name to show gap before Status columnlet short_wt = repo.add_worktree("fix", "fix");- std::fs::write(short_wt.join("quick.txt"), "quick fix").expect("Failed to write file");+ std::fs::write(short_wt.join("quick.txt"), "quick fix").unwrap();// Set user status for short branchlet mut cmd = Command::new("git");@@ -1234,7 +1224,7 @@ fn test_list_large_diffs_alignment() {cmd.args(["config", "worktrunk.status.fix", "💬"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();// Worktree with diverged status and working tree changeslet diverged_wt = repo.add_worktree("diverged", "diverged");@@ -1244,26 +1234,26 @@ fn test_list_large_diffs_alignment() {.map(|i| format!("diverged line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(diverged_wt.join("test.txt"), &diverged_content).expect("Failed to write file");+ std::fs::write(diverged_wt.join("test.txt"), &diverged_content).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&diverged_wt).output()- .expect("Failed to add");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Diverged commit"]).current_dir(&diverged_wt).output()- .expect("Failed to commit");+ .unwrap();// Add uncommitted changeslet modified_diverged = (1..=40).map(|i| format!("modified diverged line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(diverged_wt.join("test.txt"), &modified_diverged).expect("Failed to write file");+ std::fs::write(diverged_wt.join("test.txt"), &modified_diverged).unwrap();// Set user statuslet mut cmd = Command::new("git");@@ -1271,7 +1261,7 @@ fn test_list_large_diffs_alignment() {cmd.args(["config", "worktrunk.status.diverged", "💬"]).current_dir(repo.root_path()).output()- .expect("Failed to set user status");+ .unwrap();snapshot_list("large_diffs_alignment", &repo);}@@ -1290,35 +1280,35 @@ fn test_list_status_column_padding_with_emoji() {.map(|i| format!("original line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(wli_seq.join("main.txt"), &initial_content).expect("write failed");+ std::fs::write(wli_seq.join("main.txt"), &initial_content).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&wli_seq).output()- .expect("add failed");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Initial content"]).current_dir(&wli_seq).output()- .expect("commit failed");+ .unwrap();// Modify to create desired diff: remove ~111 lines, add different contentlet modified_content = (1..=89).map(|i| format!("original line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(wli_seq.join("main.txt"), &modified_content).expect("write failed");+ std::fs::write(wli_seq.join("main.txt"), &modified_content).unwrap();// Add new file with ~164 lines to get +164let new_content = (1..=164).map(|i| format!("new line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(wli_seq.join("new.txt"), &new_content).expect("write failed");+ std::fs::write(wli_seq.join("new.txt"), &new_content).unwrap();// Set user status emoji 🤖let mut cmd = Command::new("git");@@ -1326,25 +1316,25 @@ fn test_list_status_column_padding_with_emoji() {cmd.args(["config", "worktrunk.status.wli-sequence", "🤖"]).current_dir(repo.root_path()).output()- .expect("config failed");+ .unwrap();// Create "pr-link" worktree with different status (fewer symbols, same emoji type)let pr_link = repo.add_worktree("pr-link", "pr-link");// Commit to make it ahead- std::fs::write(pr_link.join("pr.txt"), "pr content").expect("write failed");+ std::fs::write(pr_link.join("pr.txt"), "pr content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&pr_link).output()- .expect("add failed");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "PR commit"]).current_dir(&pr_link).output()- .expect("commit failed");+ .unwrap();// Set same emoji typelet mut cmd = Command::new("git");@@ -1352,30 +1342,30 @@ fn test_list_status_column_padding_with_emoji() {cmd.args(["config", "worktrunk.status.pr-link", "🤖"]).current_dir(repo.root_path()).output()- .expect("config failed");+ .unwrap();// Create "main-symbol" with different emojilet main_sym = repo.add_worktree("main-symbol", "main-symbol");- std::fs::write(main_sym.join("sym.txt"), "symbol").expect("write failed");+ std::fs::write(main_sym.join("sym.txt"), "symbol").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "."]).current_dir(&main_sym).output()- .expect("add failed");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Symbol commit"]).current_dir(&main_sym).output()- .expect("commit failed");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["config", "worktrunk.status.main-symbol", "💬"]).current_dir(repo.root_path()).output()- .expect("config failed");+ .unwrap();snapshot_list("status_column_padding_emoji", &repo);}diff --git a/tests/integration_tests/list_config.rs b/tests/integration_tests/list_config.rsindex 988e21eda..21282ca6f 100644--- a/tests/integration_tests/list_config.rs+++ b/tests/integration_tests/list_config.rs@@ -48,7 +48,7 @@ fn test_list_config_branches_enabled() {cmd.args(["branch", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();let temp_home = TempDir::new().unwrap();@@ -88,7 +88,7 @@ fn test_list_config_cli_override() {cmd.args(["branch", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();let temp_home = TempDir::new().unwrap();@@ -131,7 +131,7 @@ fn test_list_config_full_and_branches() {cmd.args(["branch", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();let temp_home = TempDir::new().unwrap();@@ -172,7 +172,7 @@ fn test_list_no_config() {cmd.args(["branch", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();let temp_home = TempDir::new().unwrap();diff --git a/tests/integration_tests/list_progressive.rs b/tests/integration_tests/list_progressive.rsindex 27ab6985b..e7310b031 100644--- a/tests/integration_tests/list_progressive.rs+++ b/tests/integration_tests/list_progressive.rs@@ -33,9 +33,7 @@ fn test_list_progressive_rendering_basic() {);// Verify progressive filling: dots should decrease over time- output- .verify_progressive_filling()- .expect("Progressive filling verification failed");+ output.verify_progressive_filling().unwrap();// Verify table header appears in initial outputassert!(@@ -131,9 +129,7 @@ fn test_list_progressive_dots_decrease() {);// Use canonical verification method- output- .verify_progressive_filling()- .expect("Progressive filling verification failed");+ output.verify_progressive_filling().unwrap();}#[test]@@ -237,9 +233,7 @@ fn test_list_progressive_many_worktrees() {}// Verify progressive filling happened- output- .verify_progressive_filling()- .expect("Should show progressive data filling");+ output.verify_progressive_filling().unwrap();}/// Test that we can capture output even for fast commandsdiff --git a/tests/integration_tests/list_pty.rs b/tests/integration_tests/list_pty.rsindex 783f3e3e6..37b569ec2 100644--- a/tests/integration_tests/list_pty.rs+++ b/tests/integration_tests/list_pty.rs@@ -27,7 +27,7 @@ fn exec_wt_list_in_pty(pixel_width: 0,pixel_height: 0,})- .expect("Failed to open PTY");+ .unwrap();// Spawn wt list inside the PTYlet mut cmd = CommandBuilder::new(get_cargo_bin("wt"));@@ -41,10 +41,7 @@ fn exec_wt_list_in_pty(cmd.env_clear();cmd.env("HOME",- home::home_dir()- .expect("HOME directory required")- .to_string_lossy()- .to_string(),+ home::home_dir().unwrap().to_string_lossy().to_string(),);cmd.env("PATH",@@ -66,17 +63,11 @@ fn exec_wt_list_in_pty(cmd.env(key, value);}- let mut child = pair- .slave- .spawn_command(cmd)- .expect("Failed to spawn command in PTY");+ let mut child = pair.slave.spawn_command(cmd).unwrap();drop(pair.slave); // Close slave in parent// Get reader for the PTY master- let mut reader = pair- .master- .try_clone_reader()- .expect("Failed to clone PTY reader");+ let mut reader = pair.master.try_clone_reader().unwrap();// Read output with timeout to handle progressive renderinglet mut buf = Vec::new();@@ -107,7 +98,7 @@ fn exec_wt_list_in_pty(}// Wait for child to exit- let exit_status = child.wait().expect("Failed to wait for child");+ let exit_status = child.wait().unwrap();let exit_code = exit_status.exit_code() as i32;let output = String::from_utf8_lossy(&buf).to_string();@@ -139,20 +130,20 @@ fn test_list_pty_status_column_padding_with_emoji() {.map(|i| format!("original line {}", i)).collect::<Vec<_>>().join("\n");- std::fs::write(wli_seq.join("main.txt"), &initial_content).expect("write failed");+ std::fs::write(wli_seq.join("main.txt"), &initial_content).unwrap();let mut cmd = std::process::Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main.txt"]).current_dir(&wli_seq).output()- .expect("git add failed");+ .unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Initial content"]).current_dir(&wli_seq).output()- .expect("git commit failed");+ .unwrap();// Modify to create large diff: +164, -111 (roughly)let modified_content = (1..=253)@@ -165,57 +156,57 @@ fn test_list_pty_status_column_padding_with_emoji() {}).collect::<Vec<_>>().join("\n");- std::fs::write(wli_seq.join("main.txt"), &modified_content).expect("write failed");+ std::fs::write(wli_seq.join("main.txt"), &modified_content).unwrap();// Add untracked and modified files for Status symbols- std::fs::write(wli_seq.join("untracked.txt"), "new file").expect("write untracked failed");+ std::fs::write(wli_seq.join("untracked.txt"), "new file").unwrap();// Set user status emoji for wli-sequencerepo.configure_git_cmd(&mut cmd);cmd.args(["config", "worktrunk.status.wli-sequence", "🤖"]).current_dir(repo.root_path()).output()- .expect("config set failed");+ .unwrap();// Create pr-link worktree with emojilet pr_link = repo.add_worktree("pr-link", "pr-link");- std::fs::write(pr_link.join("pr.txt"), "PR commit").expect("write failed");+ std::fs::write(pr_link.join("pr.txt"), "PR commit").unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["add", "pr.txt"]).current_dir(&pr_link).output()- .expect("git add failed");+ .unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "PR commit"]).current_dir(&pr_link).output()- .expect("git commit failed");+ .unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["config", "worktrunk.status.pr-link", "🤖"]).current_dir(repo.root_path()).output()- .expect("config set failed");+ .unwrap();// Create main-symbol worktree with emojilet main_symbol = repo.add_worktree("main-symbol", "main-symbol");- std::fs::write(main_symbol.join("symbol.txt"), "Symbol commit").expect("write failed");+ std::fs::write(main_symbol.join("symbol.txt"), "Symbol commit").unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["add", "symbol.txt"]).current_dir(&main_symbol).output()- .expect("git add failed");+ .unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Symbol commit"]).current_dir(&main_symbol).output()- .expect("git commit failed");+ .unwrap();repo.configure_git_cmd(&mut cmd);cmd.args(["config", "worktrunk.status.main-symbol", "💬"]).current_dir(repo.root_path()).output()- .expect("config set failed");+ .unwrap();// Run wt list in PTYlet env_vars = vec![(diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rsindex 720ec0d00..8d021dad4 100644--- a/tests/integration_tests/merge.rs+++ b/tests/integration_tests/merge.rs@@ -54,26 +54,25 @@ fn setup_merge_scenario() -> (TestRepo, std::path::PathBuf) {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();(repo, feature_wt)}@@ -92,38 +91,38 @@ fn setup_merge_scenario_multi_commit() -> (TestRepo, std::path::PathBuf) {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content 1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content 1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add file 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();- std::fs::write(feature_wt.join("file2.txt"), "content 2").expect("Failed to write file");+ std::fs::write(feature_wt.join("file2.txt"), "content 2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file2.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add file 2"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();(repo, feature_wt)}@@ -150,22 +149,21 @@ fn test_merge_when_primary_not_on_default_but_default_has_worktree() {// Create a feature worktree and commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();snapshot_merge("merge_when_primary_not_on_default_but_default_has_worktree",@@ -206,8 +204,7 @@ fn test_merge_dirty_working_tree() {// Create a feature worktree with uncommitted changeslet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("dirty.txt"), "uncommitted content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("dirty.txt"), "uncommitted content").unwrap();// Try to merge (should fail due to dirty working tree)snapshot_merge(@@ -226,41 +223,39 @@ fn test_merge_not_fast_forward() {// Create commits in both branches// Add commit to main (repo root)- std::fs::write(repo.root_path().join("main.txt"), "main content")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("main.txt"), "main content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add main file"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();// Create a feature worktree branching from before the main commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to merge (should fail or require actual merge)snapshot_merge(@@ -276,15 +271,14 @@ fn test_merge_rebase_conflict() {let mut repo = TestRepo::new();// Create a shared file- std::fs::write(repo.root_path().join("shared.txt"), "initial content\n")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("shared.txt"), "initial content\n").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "shared.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();repo.commit("Add shared file");repo.setup_remote("main");@@ -296,25 +290,24 @@ fn test_merge_rebase_conflict() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Modify shared.txt in main branch (from the base commit)- std::fs::write(repo.root_path().join("shared.txt"), "main version\n")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("shared.txt"), "main version\n").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "shared.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Update shared.txt in main"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();// Create a feature worktree branching from before the main commit// We need to create it from the original commit, not current main@@ -324,7 +317,7 @@ fn test_merge_rebase_conflict() {.args(["rev-parse", "HEAD~1"]).current_dir(repo.root_path()).output()- .expect("Failed to get previous commit");+ .unwrap();let base_commit = String::from_utf8_lossy(&output.stdout).trim().to_string();let feature_wt = repo.root_path().parent().unwrap().join("test-repo.feature");@@ -340,25 +333,24 @@ fn test_merge_rebase_conflict() {]).current_dir(repo.root_path()).output()- .expect("Failed to add feature worktree");+ .unwrap();// Modify the same file with conflicting content- std::fs::write(feature_wt.join("shared.txt"), "feature version\n")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("shared.txt"), "feature version\n").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "shared.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Update shared.txt in feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to merge - should fail with rebase conflictsnapshot_merge("merge_rebase_conflict", &repo, &["main"], Some(&feature_wt));@@ -402,52 +394,52 @@ fn test_merge_squash_deterministic() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content 1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content 1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add file 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();- std::fs::write(feature_wt.join("file2.txt"), "content 2").expect("Failed to write file");+ std::fs::write(feature_wt.join("file2.txt"), "content 2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file2.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "fix: update logic"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();- std::fs::write(feature_wt.join("file3.txt"), "content 3").expect("Failed to write file");+ std::fs::write(feature_wt.join("file3.txt"), "content 3").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file3.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "docs: update readme"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge (squashing is now the default - no LLM configured, should use deterministic message)snapshot_merge(@@ -471,39 +463,38 @@ fn test_merge_squash_with_llm() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("auth.txt"), "auth module").expect("Failed to write file");+ std::fs::write(feature_wt.join("auth.txt"), "auth module").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add authentication"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();- std::fs::write(feature_wt.join("auth.txt"), "auth module updated")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("auth.txt"), "auth module updated").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "fix: handle edge case"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Configure mock LLM command via config file// Use sh to consume stdin and return a fixed message@@ -512,7 +503,7 @@ fn test_merge_squash_with_llm() {command = "sh"args = ["-c", "cat >/dev/null && echo 'feat: implement user authentication system'"]"#;- fs::write(repo.test_config_path(), worktrunk_config).expect("Failed to write worktrunk config");+ fs::write(repo.test_config_path(), worktrunk_config).unwrap();// (squashing is now the default, no need for --squash flag)snapshot_merge("merge_squash_with_llm", &repo, &["main"], Some(&feature_wt));@@ -531,38 +522,38 @@ fn test_merge_squash_llm_fallback() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content 1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content 1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: new feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();- std::fs::write(feature_wt.join("file2.txt"), "content 2").expect("Failed to write file");+ std::fs::write(feature_wt.join("file2.txt"), "content 2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file2.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "fix: bug fix"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Configure LLM command that will fail (non-existent command)// Should now error instead of falling back@@ -592,24 +583,24 @@ fn test_merge_squash_single_commit() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with only one commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: single commit"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge (squashing is default) - should skip squashing since there's only one commitsnapshot_merge(@@ -646,59 +637,59 @@ fn test_merge_squash_empty_changes() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with commits that result in no net changeslet feature_wt = repo.add_worktree("feature", "feature");// Get the initial content of file.txt (created by the initial commit)let file_path = feature_wt.join("file.txt");- let initial_content = std::fs::read_to_string(&file_path).expect("Failed to read file.txt");+ let initial_content = std::fs::read_to_string(&file_path).unwrap();// Commit 1: Modify file.txt- std::fs::write(&file_path, "change1").expect("Failed to write file");+ std::fs::write(&file_path, "change1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Change 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Commit 2: Modify file.txt again- std::fs::write(&file_path, "change2").expect("Failed to write file");+ std::fs::write(&file_path, "change2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Change 2"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Commit 3: Revert to original content- std::fs::write(&file_path, initial_content).expect("Failed to write file");+ std::fs::write(&file_path, initial_content).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Revert to initial"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge (squashing is default) - should succeed even when commits result in no net changessnapshot_merge(@@ -722,30 +713,28 @@ fn test_merge_auto_commit_deterministic() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with a commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "initial content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "initial content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: initial feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Now add uncommitted tracked changes- std::fs::write(feature_wt.join("feature.txt"), "modified content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "modified content").unwrap();// Merge - should auto-commit with deterministic message (no LLM configured)snapshot_merge(@@ -769,29 +758,28 @@ fn test_merge_auto_commit_with_llm() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with a commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("auth.txt"), "initial auth").expect("Failed to write file");+ std::fs::write(feature_wt.join("auth.txt"), "initial auth").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add authentication"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Now add uncommitted tracked changes- std::fs::write(feature_wt.join("auth.txt"), "improved auth with validation")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("auth.txt"), "improved auth with validation").unwrap();// Configure mock LLM command via config file// Use sh to consume stdin and return a fixed message (must consume stdin for cross-platform compatibility)@@ -800,7 +788,7 @@ fn test_merge_auto_commit_with_llm() {command = "sh"args = ["-c", "cat >/dev/null && echo 'fix: improve auth validation logic'"]"#;- fs::write(repo.test_config_path(), worktrunk_config).expect("Failed to write worktrunk config");+ fs::write(repo.test_config_path(), worktrunk_config).unwrap();// Merge with LLM configured - should auto-commit with LLM messagesnapshot_merge(@@ -816,8 +804,7 @@ fn test_merge_auto_commit_and_squash() {let (repo, feature_wt) = setup_merge_scenario_multi_commit();// Add uncommitted tracked changes- std::fs::write(feature_wt.join("file1.txt"), "updated content 1")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "updated content 1").unwrap();// Configure mock LLM command via config file// Use sh to consume stdin and return a fixed message (must consume stdin for cross-platform compatibility)@@ -826,7 +813,7 @@ fn test_merge_auto_commit_and_squash() {command = "sh"args = ["-c", "cat >/dev/null && echo 'fix: update file 1 content'"]"#;- fs::write(repo.test_config_path(), worktrunk_config).expect("Failed to write worktrunk config");+ fs::write(repo.test_config_path(), worktrunk_config).unwrap();// Merge (squashing is default) - should stage uncommitted changes, then squash all commits including the staged changessnapshot_merge(@@ -850,29 +837,27 @@ fn test_merge_with_untracked_files() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with one commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content 1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content 1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add file 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Add untracked files- std::fs::write(feature_wt.join("untracked1.txt"), "untracked content 1")- .expect("Failed to write file");- std::fs::write(feature_wt.join("untracked2.txt"), "untracked content 2")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("untracked1.txt"), "untracked content 1").unwrap();+ std::fs::write(feature_wt.join("untracked2.txt"), "untracked content 2").unwrap();// Merge - should show warning about untracked filessnapshot_merge_with_env(@@ -895,12 +880,12 @@ fn test_merge_pre_merge_command_success() {// Create project config with pre-merge commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"pre-merge-command = "exit 0""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -911,25 +896,25 @@ fn test_merge_pre_merge_command_success() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --force to skip approval promptssnapshot_merge(@@ -948,12 +933,12 @@ fn test_merge_pre_merge_command_failure() {// Create project config with failing pre-merge commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"pre-merge-command = "exit 1""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -964,25 +949,25 @@ fn test_merge_pre_merge_command_failure() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --force - pre-merge command should fail and block mergesnapshot_merge(@@ -1001,12 +986,12 @@ fn test_merge_pre_merge_command_no_hooks() {// Create project config with failing pre-merge commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"pre-merge-command = "exit 1""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1017,25 +1002,25 @@ fn test_merge_pre_merge_command_no_hooks() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --no-hooks - should skip pre-merge commands and succeedsnapshot_merge(@@ -1054,7 +1039,7 @@ fn test_merge_pre_merge_command_named() {// Create project config with named pre-merge commandslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"@@ -1064,7 +1049,7 @@ lint = "exit 0"test = "exit 0""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1075,25 +1060,25 @@ test = "exit 0"cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --force - all pre-merge commands should passsnapshot_merge(@@ -1112,12 +1097,12 @@ fn test_merge_post_merge_command_success() {// Create project config with post-merge command that writes a marker filelet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-merge-command = "echo 'merged {{ branch }} to {{ target }}' > post-merge-ran.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1128,25 +1113,25 @@ fn test_merge_post_merge_command_success() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --forcesnapshot_merge(@@ -1162,7 +1147,7 @@ fn test_merge_post_merge_command_success() {marker_file.exists(),"Post-merge command should have created marker file in main worktree");- let content = fs::read_to_string(&marker_file).expect("Failed to read marker file");+ let content = fs::read_to_string(&marker_file).unwrap();assert!(content.contains("merged feature to main"),"Marker file should contain correct branch and target: {}",@@ -1178,12 +1163,12 @@ fn test_merge_post_merge_command_skipped_with_no_verify() {// Create project config with post-merge command that writes a marker filelet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-merge-command = "echo 'merged {{ branch }} to {{ target }}' > post-merge-ran.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1194,25 +1179,25 @@ fn test_merge_post_merge_command_skipped_with_no_verify() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --no-verify - hook should be skipped entirelysnapshot_merge(@@ -1238,12 +1223,12 @@ fn test_merge_post_merge_command_failure() {// Create project config with failing post-merge commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-merge-command = "exit 1""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1254,25 +1239,25 @@ fn test_merge_post_merge_command_failure() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --force - post-merge command should fail but merge should completesnapshot_merge(@@ -1291,7 +1276,7 @@ fn test_merge_post_merge_command_named() {// Create project config with named post-merge commandslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"@@ -1300,7 +1285,7 @@ notify = "echo 'Merge to {{ target }} complete' > notify.txt"deploy = "echo 'Deploying branch {{ branch }}' > deploy.txt""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1311,25 +1296,25 @@ deploy = "echo 'Deploying branch {{ branch }}' > deploy.txt"cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --forcesnapshot_merge(@@ -1360,12 +1345,12 @@ fn test_merge_pre_commit_command_success() {// Create project config with pre-commit commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"pre-commit-command = "echo 'Pre-commit check passed'""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1376,11 +1361,11 @@ fn test_merge_pre_commit_command_success() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a changelet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();// Merge with --force (changes uncommitted, should trigger pre-commit hook)snapshot_merge(@@ -1399,12 +1384,12 @@ fn test_merge_pre_commit_command_failure() {// Create project config with failing pre-commit commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"pre-commit-command = "exit 1""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1415,11 +1400,11 @@ fn test_merge_pre_commit_command_failure() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a changelet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();// Merge with --force - pre-commit command should fail and block mergesnapshot_merge(@@ -1438,12 +1423,12 @@ fn test_merge_pre_squash_command_success() {// Create project config with pre-commit command (used for both squash and no-squash)let config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),"pre-commit-command = \"echo 'Pre-commit check passed'\"",)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1454,25 +1439,25 @@ fn test_merge_pre_squash_command_success() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make commitslet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --force (squashing is now the default)snapshot_merge(@@ -1491,12 +1476,12 @@ fn test_merge_pre_squash_command_failure() {// Create project config with failing pre-commit command (used for both squash and no-squash)let config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"pre-commit-command = "exit 1""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -1507,25 +1492,25 @@ fn test_merge_pre_squash_command_failure() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make commitslet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --force (squashing is default) - pre-commit command should fail and block mergesnapshot_merge(@@ -1544,21 +1529,21 @@ fn test_merge_no_remote() {// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to merge without specifying target (should fail - no remote to get default branch)snapshot_merge("merge_no_remote", &repo, &[], Some(&feature_wt));@@ -1609,21 +1594,21 @@ pub fn refresh(refresh_token: &str) -> String {format!("{}::refreshed", refresh_token)}"#;- std::fs::write(feature_wt.join("auth.rs"), auth_rs).expect("Failed to write file");+ std::fs::write(feature_wt.join("auth.rs"), auth_rs).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth.rs"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Implement JWT validation"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Snapshot the merge commandsnapshot_merge("readme_example_simple", &repo, &["main"], Some(&feature_wt));@@ -1643,11 +1628,11 @@ fn test_readme_example_complex() {// Create project config with multiple hookslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();// Create mock commands for realistic outputlet bin_dir = repo.root_path().join(".bin");- fs::create_dir_all(&bin_dir).expect("Failed to create bin dir");+ fs::create_dir_all(&bin_dir).unwrap();// Mock cargo that handles both test and clippy subcommandslet cargo_script = r#"#!/bin/sh@@ -1679,7 +1664,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("cargo"), cargo_script).expect("Failed to write cargo script");+ fs::write(bin_dir.join("cargo"), cargo_script).unwrap();// Mock llm command that generates a high-quality commit messagelet llm_script = r#"#!/bin/sh@@ -1699,7 +1684,7 @@ API authentication.- Create test suite covering all authentication flowsEOF"#;- fs::write(bin_dir.join("llm"), llm_script).expect("Failed to write llm script");+ fs::write(bin_dir.join("llm"), llm_script).unwrap();// Make scripts executable (Unix only - Windows doesn't use executable bits)#[cfg(unix)]@@ -1723,7 +1708,7 @@ EOF"install" = "cargo install --path .""#;- fs::write(config_dir.join("wt.toml"), config_content).expect("Failed to write project config");+ fs::write(config_dir.join("wt.toml"), config_content).unwrap();// Commit the config and mock cargolet mut cmd = Command::new("git");@@ -1731,14 +1716,14 @@ EOFcmd.args(["add", ".config/wt.toml", ".bin"]).current_dir(repo.root_path()).output()- .expect("Failed to add config");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add project automation config"]).current_dir(repo.root_path()).output()- .expect("Failed to commit config");+ .unwrap();// Create a worktree for mainlet main_wt = repo.root_path().parent().unwrap().join("test-repo.main-wt");@@ -1747,7 +1732,7 @@ EOFcmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature-auth", "feature-auth");@@ -1762,19 +1747,19 @@ pub fn needs_rotation(issued_at: u64, ttl: u64, now: u64) -> bool {now.saturating_sub(issued_at) > ttl}"#;- std::fs::write(feature_wt.join("auth.rs"), commit_one).expect("Failed to write file");+ std::fs::write(feature_wt.join("auth.rs"), commit_one).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth.rs"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add token refresh logic"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Second commit: JWT validationlet commit_two = r#"// JWT validation@@ -1786,19 +1771,19 @@ pub fn decode_claims(token: &str) -> Option<&str> {token.split('.').nth(1)}"#;- std::fs::write(feature_wt.join("jwt.rs"), commit_two).expect("Failed to write file");+ std::fs::write(feature_wt.join("jwt.rs"), commit_two).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "jwt.rs"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Implement JWT validation"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Third commit: testslet commit_three = r#"// Tests@@ -1819,19 +1804,19 @@ mod tests {}}"#;- std::fs::write(feature_wt.join("auth_test.rs"), commit_three).expect("Failed to write file");+ std::fs::write(feature_wt.join("auth_test.rs"), commit_three).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth_test.rs"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add authentication tests"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Configure LLM in worktrunk config for deterministic, high-quality commit messageslet llm_path = bin_dir.join("llm");@@ -1842,7 +1827,7 @@ command = "{}""#,llm_path.display());- fs::write(repo.test_config_path(), worktrunk_config).expect("Failed to write worktrunk config");+ fs::write(repo.test_config_path(), worktrunk_config).unwrap();// Merge with --force to skip approval prompts for commands// This test explicitly sets PATH (which will be captured in snapshot) because it needs@@ -1880,11 +1865,11 @@ fn test_readme_example_hooks_post_create() {// Create project config with post-create and post-start hookslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();// Create mock commands for realistic outputlet bin_dir = repo.root_path().join(".bin");- fs::create_dir_all(&bin_dir).expect("Failed to create bin dir");+ fs::create_dir_all(&bin_dir).unwrap();// Mock uv command that simulates dependency installationlet uv_script = r#"#!/bin/sh@@ -1902,7 +1887,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("uv"), uv_script).expect("Failed to write uv script");+ fs::write(bin_dir.join("uv"), uv_script).unwrap();// Make scripts executable (Unix only)#[cfg(unix)]@@ -1921,7 +1906,7 @@ fi"dev" = "uv run dev""#;- fs::write(config_dir.join("wt.toml"), config_content).expect("Failed to write project config");+ fs::write(config_dir.join("wt.toml"), config_content).unwrap();// Commit the configlet mut cmd = Command::new("git");@@ -1929,14 +1914,14 @@ ficmd.args(["add", ".config/wt.toml", ".bin"]).current_dir(repo.root_path()).output()- .expect("Failed to add config");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add project hooks"]).current_dir(repo.root_path()).output()- .expect("Failed to commit config");+ .unwrap();// Set PATH to include mock commands and run switch --create with --forcelet path_with_bin = format!(@@ -1966,11 +1951,11 @@ fn test_readme_example_hooks_pre_merge() {// Create project config with pre-merge hookslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();// Create mock commands for realistic outputlet bin_dir = repo.root_path().join(".bin");- fs::create_dir_all(&bin_dir).expect("Failed to create bin dir");+ fs::create_dir_all(&bin_dir).unwrap();// Mock pytest commandlet pytest_script = r#"#!/bin/sh@@ -1988,7 +1973,7 @@ tests/test_auth.py::test_token_validation PASSED [100%]EOFexit 0"#;- fs::write(bin_dir.join("pytest"), pytest_script).expect("Failed to write pytest script");+ fs::write(bin_dir.join("pytest"), pytest_script).unwrap();// Mock ruff commandlet ruff_script = r#"#!/bin/sh@@ -2002,7 +1987,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("ruff"), ruff_script).expect("Failed to write ruff script");+ fs::write(bin_dir.join("ruff"), ruff_script).unwrap();// Mock llm command for commit messagelet llm_script = r#"#!/bin/sh@@ -2014,7 +1999,7 @@ Implement login and token refresh endpoints with JWT validation.Includes comprehensive test coverage and input validation.EOF"#;- fs::write(bin_dir.join("llm"), llm_script).expect("Failed to write llm script");+ fs::write(bin_dir.join("llm"), llm_script).unwrap();// Mock uv command for running pytest and rufflet uv_script = r#"#!/bin/sh@@ -2028,7 +2013,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("uv"), uv_script).expect("Failed to write uv script");+ fs::write(bin_dir.join("uv"), uv_script).unwrap();// Make scripts executable (Unix only)#[cfg(unix)]@@ -2047,7 +2032,7 @@ fi"lint" = "uv run ruff check""#;- fs::write(config_dir.join("wt.toml"), config_content).expect("Failed to write project config");+ fs::write(config_dir.join("wt.toml"), config_content).unwrap();// Commit the configlet mut cmd = Command::new("git");@@ -2055,14 +2040,14 @@ ficmd.args(["add", ".config/wt.toml", ".bin"]).current_dir(repo.root_path()).output()- .expect("Failed to add config");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add pre-merge hooks"]).current_dir(repo.root_path()).output()- .expect("Failed to commit config");+ .unwrap();// Create a worktree for mainlet main_wt = repo.root_path().parent().unwrap().join("test-repo.main-wt");@@ -2071,13 +2056,13 @@ ficmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature-auth", "feature-auth");// First commit - create initial auth.py with login endpoint- fs::create_dir_all(feature_wt.join("api")).expect("Failed to create api dir");+ fs::create_dir_all(feature_wt.join("api")).unwrap();let auth_py_v1 = r#"# Authentication API endpointsfrom typing import Dict, Optionalimport jwt@@ -2097,22 +2082,22 @@ def login(username: str, password: str) -> Optional[Dict]:token = jwt.encode(payload, 'secret', algorithm='HS256')return {'token': token, 'expires_in': 3600}"#;- std::fs::write(feature_wt.join("api/auth.py"), auth_py_v1).expect("Failed to write file");+ std::fs::write(feature_wt.join("api/auth.py"), auth_py_v1).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "api/auth.py"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add login endpoint"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Second commit - add tests- fs::create_dir_all(feature_wt.join("tests")).expect("Failed to create tests dir");+ fs::create_dir_all(feature_wt.join("tests")).unwrap();let test_auth_py = r#"# Authentication endpoint testsimport pytestfrom api.auth import login@@ -2128,20 +2113,19 @@ def test_login_invalid_password():def test_token_validation():assert login('valid_user', 'valid_pass')['expires_in'] == 3600"#;- std::fs::write(feature_wt.join("tests/test_auth.py"), test_auth_py)- .expect("Failed to write file");+ std::fs::write(feature_wt.join("tests/test_auth.py"), test_auth_py).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "tests/test_auth.py"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add authentication tests"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Third commit - add refresh endpointlet auth_py_v2 = r#"# Authentication API endpoints@@ -2176,19 +2160,19 @@ def refresh_token(token: str) -> Optional[Dict]:except jwt.InvalidTokenError:return None"#;- std::fs::write(feature_wt.join("api/auth.py"), auth_py_v2).expect("Failed to write file");+ std::fs::write(feature_wt.join("api/auth.py"), auth_py_v2).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "api/auth.py"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add validation"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Configure LLM in worktrunk configlet llm_path = bin_dir.join("llm");@@ -2199,7 +2183,7 @@ command = "{}""#,llm_path.display());- fs::write(repo.test_config_path(), worktrunk_config).expect("Failed to write worktrunk config");+ fs::write(repo.test_config_path(), worktrunk_config).unwrap();// Set PATH and merge with --forcelet path_with_bin = format!(@@ -2228,25 +2212,25 @@ fn test_merge_no_commit_with_clean_tree() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with commits (clean tree)let feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --no-commit (should succeed - clean tree)let settings = setup_snapshot_settings(&repo);@@ -2281,25 +2265,24 @@ fn test_merge_no_commit_with_dirty_tree() {// Create a feature worktree with a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("committed.txt"), "committed content").expect("Failed to write file");+ fs::write(feature_wt.join("committed.txt"), "committed content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "committed.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add committed file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Add uncommitted changes- fs::write(feature_wt.join("uncommitted.txt"), "uncommitted content")- .expect("Failed to write file");+ fs::write(feature_wt.join("uncommitted.txt"), "uncommitted content").unwrap();// Try to merge with --no-commit (should fail - dirty tree)let settings = setup_snapshot_settings(&repo);@@ -2332,25 +2315,25 @@ fn test_merge_no_commit_no_squash_no_remove_redundant() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree with commits (clean tree)let feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge with --no-commit --no-squash --no-remove (redundant but valid - should succeed)let settings = setup_snapshot_settings(&repo);@@ -2404,7 +2387,7 @@ fn test_merge_no_commits_with_changes() {// Create a feature worktree with NO commits but WITH uncommitted changeslet feature_wt = repo.add_worktree("no-commits-dirty", "no-commits-dirty");- fs::write(feature_wt.join("newfile.txt"), "new content").expect("Failed to write file");+ fs::write(feature_wt.join("newfile.txt"), "new content").unwrap();// Merge - should commit the changes, skip squashing (only 1 commit), and skip rebasing (at merge base)snapshot_merge(@@ -2427,22 +2410,21 @@ fn test_merge_rebase_fast_forward() {let feature_wt = repo.add_worktree("fast-forward-test", "fast-forward-test");// Advance main with a new commit (in the primary worktree which is on main)- fs::write(repo.root_path().join("main-update.txt"), "main content")- .expect("Failed to write file");+ fs::write(repo.root_path().join("main-update.txt"), "main content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main-update.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Update main"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();// Merge - should fast-forward (no commits to replay)snapshot_merge(@@ -2463,39 +2445,38 @@ fn test_merge_rebase_true_rebase() {// Create a feature worktree with a commitlet feature_wt = repo.add_worktree("true-rebase-test", "true-rebase-test");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Advance main with a new commit (in the primary worktree which is on main)- fs::write(repo.root_path().join("main-update.txt"), "main content")- .expect("Failed to write file");+ fs::write(repo.root_path().join("main-update.txt"), "main content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main-update.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Update main"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();// Merge - should show rebasing progress (has commits to replay)snapshot_merge(@@ -2517,21 +2498,21 @@ fn test_merge_primary_on_different_branch() {// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature-from-develop", "feature-from-develop");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();snapshot_merge("merge_primary_on_different_branch",@@ -2551,21 +2532,21 @@ fn test_merge_primary_on_different_branch_dirty() {repo.setup_remote("main");// Make main and develop diverge - modify file.txt on main- fs::write(repo.root_path().join("file.txt"), "main version").expect("Failed to modify file");+ fs::write(repo.root_path().join("file.txt"), "main version").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Update file on main"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();// Create a develop branch from the previous commit (before the main update)let mut cmd = Command::new("git");@@ -2574,7 +2555,7 @@ fn test_merge_primary_on_different_branch_dirty() {.args(["rev-parse", "HEAD~1"]).current_dir(repo.root_path()).output()- .expect("Failed to get previous commit");+ .unwrap();let base_commit = String::from_utf8_lossy(&output.stdout).trim().to_string();let mut cmd = Command::new("git");@@ -2582,30 +2563,29 @@ fn test_merge_primary_on_different_branch_dirty() {cmd.args(["switch", "-c", "develop", &base_commit]).current_dir(repo.root_path()).output()- .expect("Failed to create develop branch");+ .unwrap();// Modify file.txt in develop (uncommitted) to a different value// This will conflict when trying to switch to main- fs::write(repo.root_path().join("file.txt"), "develop local changes")- .expect("Failed to modify file");+ fs::write(repo.root_path().join("file.txt"), "develop local changes").unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature-dirty-primary", "feature-dirty-primary");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to merge to main - should fail because primary has uncommitted changes that conflictsnapshot_merge(@@ -2629,25 +2609,25 @@ fn test_merge_race_condition_commit_after_push() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Merge to main (this pushes the branch to main)snapshot_merge(@@ -2660,21 +2640,21 @@ fn test_merge_race_condition_commit_after_push() {// RACE CONDITION: Simulate another developer adding a commit to the feature branch// after the merge/push but before worktree removal and branch deletion.// Since feature is already checked out in feature_wt, we'll add the commit directly there.- fs::write(feature_wt.join("extra.txt"), "race condition commit").expect("Failed to write file");+ fs::write(feature_wt.join("extra.txt"), "race condition commit").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "extra.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add extra file (race condition)"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Now simulate what wt merge would do: remove the worktreelet mut cmd = Command::new("git");@@ -2682,7 +2662,7 @@ fn test_merge_race_condition_commit_after_push() {cmd.args(["worktree", "remove", feature_wt.to_str().unwrap()]).current_dir(repo.root_path()).output()- .expect("Failed to remove worktree");+ .unwrap();// Try to delete the branch with -d (safe delete)// This should FAIL because the branch has the race condition commit not in main@@ -2692,7 +2672,7 @@ fn test_merge_race_condition_commit_after_push() {.args(["branch", "-d", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to run git branch -d");+ .unwrap();// Verify the deletion failed (non-zero exit code)assert!(@@ -2715,7 +2695,7 @@ fn test_merge_race_condition_commit_after_push() {.args(["branch", "--list", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to list branches");+ .unwrap();let stdout = String::from_utf8_lossy(&output.stdout);assert!(@@ -2736,22 +2716,21 @@ fn test_merge_to_non_default_target() {cmd.args(["switch", "main"]).current_dir(repo.root_path()).output()- .expect("Failed to switch to main");+ .unwrap();- std::fs::write(repo.root_path().join("main-file.txt"), "main content")- .expect("Failed to write main file");+ std::fs::write(repo.root_path().join("main-file.txt"), "main content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main-file.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add main file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add main-specific file"]).current_dir(repo.root_path()).output()- .expect("Failed to commit to main");+ .unwrap();// Create a staging branch from BEFORE the main commitlet mut cmd = Command::new("git");@@ -2760,7 +2739,7 @@ fn test_merge_to_non_default_target() {.args(["rev-parse", "HEAD~1"]).current_dir(repo.root_path()).output()- .expect("Failed to get parent commit");+ .unwrap();let base_commit = String::from_utf8_lossy(&output.stdout).trim().to_string();let mut cmd = Command::new("git");@@ -2768,23 +2747,22 @@ fn test_merge_to_non_default_target() {cmd.args(["switch", "-c", "staging", &base_commit]).current_dir(repo.root_path()).output()- .expect("Failed to create staging branch");+ .unwrap();// Add a commit to staging to make it different from main- std::fs::write(repo.root_path().join("staging-file.txt"), "staging content")- .expect("Failed to write staging file");+ std::fs::write(repo.root_path().join("staging-file.txt"), "staging content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "staging-file.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add staging file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add staging-specific file"]).current_dir(repo.root_path()).output()- .expect("Failed to commit to staging");+ .unwrap();// Create a worktree for staginglet staging_wt = repo@@ -2797,7 +2775,7 @@ fn test_merge_to_non_default_target() {cmd.args(["worktree", "add", staging_wt.to_str().unwrap(), "staging"]).current_dir(repo.root_path()).output()- .expect("Failed to add staging worktree");+ .unwrap();// Create a feature worktree from the base commit (before both main and staging diverged)let feature_wt = repo@@ -2817,24 +2795,23 @@ fn test_merge_to_non_default_target() {]).current_dir(repo.root_path()).output()- .expect("Failed to add feature worktree");+ .unwrap();- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write feature file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add feature file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature for staging"]).current_dir(&feature_wt).output()- .expect("Failed to commit feature");+ .unwrap();// Merge to staging explicitly (NOT to main)// This should rebase onto staging (which has staging-file.txt)@@ -2860,38 +2837,37 @@ fn test_merge_squash_with_working_tree_creates_backup() {let feature_wt = repo.add_worktree("feature", "feature");// First commit- std::fs::write(feature_wt.join("file1.txt"), "content 1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content 1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add file 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Second commit- std::fs::write(feature_wt.join("file2.txt"), "content 2").expect("Failed to write file");+ std::fs::write(feature_wt.join("file2.txt"), "content 2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file2.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "feat: add file 2"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Add uncommitted tracked changes that will be included in the squash- std::fs::write(feature_wt.join("file1.txt"), "updated content 1")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "updated content 1").unwrap();// Merge with squash (default behavior)// This should create a backup before squashing because there are uncommitted changes@@ -2914,7 +2890,7 @@ fn test_merge_squash_with_working_tree_creates_backup() {.args(["reflog", "show", "refs/wt-backup/feature"]).current_dir(repo.root_path()).output()- .expect("Failed to show reflog");+ .unwrap();let reflog = String::from_utf8_lossy(&output.stdout);assert!(@@ -2944,11 +2920,11 @@ fn test_merge_does_not_permanently_set_receive_deny_current_branch() {cmd.args(["config", "receive.denyCurrentBranch", "refuse"]).current_dir(repo.root_path()).output()- .expect("Failed to set config");+ .unwrap();// Perform merge - should succeed despite "refuse" setting because we use --receive-packlet mut cmd = make_snapshot_cmd(&repo, "merge", &["main"], Some(&feature_wt));- let output = cmd.output().expect("Failed to run merge");+ let output = cmd.output().unwrap();assert!(output.status.success(),"Merge should succeed even with receive.denyCurrentBranch=refuse.\n\@@ -2965,7 +2941,7 @@ fn test_merge_does_not_permanently_set_receive_deny_current_branch() {.args(["config", "receive.denyCurrentBranch"]).current_dir(repo.root_path()).output()- .expect("Failed to get config");+ .unwrap();let after_value = String::from_utf8_lossy(&after.stdout).trim().to_string();assert_eq!(diff --git a/tests/integration_tests/post_start_commands.rs b/tests/integration_tests/post_start_commands.rsindex 63187db9a..cccdd209c 100644--- a/tests/integration_tests/post_start_commands.rs+++ b/tests/integration_tests/post_start_commands.rs@@ -213,7 +213,7 @@ approved-commands = ["info.txt should have been created in the worktree");- let contents = fs::read_to_string(&info_file).expect("Failed to read info.txt");+ let contents = fs::read_to_string(&info_file).unwrap();// Verify that template variables were actually expandedassert!(@@ -424,7 +424,7 @@ approved-commands = ["echo 'stdout output' && echo 'stderr output' >&2"]// Find the log filelet log_files: Vec<_> = fs::read_dir(&log_dir)- .expect("Failed to read log dir")+ .unwrap().filter_map(|e| e.ok()).map(|e| e.path()).filter(|p| p.extension().and_then(|s| s.to_str()) == Some("log"))@@ -437,7 +437,7 @@ approved-commands = ["echo 'stdout output' && echo 'stderr output' >&2"]log_files);- let log_contents = fs::read_to_string(&log_files[0]).expect("Failed to read log file");+ let log_contents = fs::read_to_string(&log_files[0]).unwrap();// Verify both stdout and stderr were capturedassert_snapshot!(log_contents, @r"@@ -519,7 +519,7 @@ approved-commands = [let git_common_dir = resolve_git_common_dir(&worktree_path);let log_dir = git_common_dir.join("wt-logs");let log_files: Vec<_> = fs::read_dir(&log_dir)- .expect("Failed to read log dir")+ .unwrap().filter_map(|e| e.ok()).filter(|e| e.path().extension().and_then(|s| s.to_str()) == Some("log")).collect();@@ -534,7 +534,7 @@ approved-commands = [// Read all log files and verify no cross-contaminationlet mut found_outputs = vec![false, false, false];for entry in log_files {- let contents = fs::read_to_string(entry.path()).expect("Failed to read log file");+ let contents = fs::read_to_string(entry.path()).unwrap();let count_task1 = contents.matches("TASK1_OUTPUT").count();let count_task2 = contents.matches("TASK2_OUTPUT").count();let count_task3 = contents.matches("TASK3_OUTPUT").count();@@ -650,7 +650,7 @@ approved-commands = ["echo 'line1\nline2\nline3' | grep line2 > filtered.txt"]"Complex shell command should create output file");- let contents = fs::read_to_string(&filtered_file).expect("Failed to read filtered.txt");+ let contents = fs::read_to_string(&filtered_file).unwrap();assert_snapshot!(contents, @"line2");}@@ -703,7 +703,7 @@ approved-commands = [""""Multiline command should create output file");- let contents = fs::read_to_string(&output_file).expect("Failed to read multiline.txt");+ let contents = fs::read_to_string(&output_file).unwrap();assert_snapshot!(contents, @r"first linesecond line@@ -761,7 +761,7 @@ approved-commands = [""""Control structure command should create result file");- let contents = fs::read_to_string(&result_file).expect("Failed to read result.txt");+ let contents = fs::read_to_string(&result_file).unwrap();assert_snapshot!(contents, @"File does not exist");}@@ -814,7 +814,7 @@ approved-commands = ["echo 'POST-START-RAN' > post_start_marker.txt"]);// Remove the marker file to detect if post-start runs again- fs::remove_file(&marker_file).expect("Failed to remove marker file");+ fs::remove_file(&marker_file).unwrap();// Second: Switch to EXISTING worktree - post-start should NOT runsnapshot_switch("post_start_skip_existing", &repo, &["feature"]);diff --git a/tests/integration_tests/push.rs b/tests/integration_tests/push.rsindex ab28a3fc6..2ab9c691e 100644--- a/tests/integration_tests/push.rs+++ b/tests/integration_tests/push.rs@@ -27,25 +27,25 @@ fn test_push_fast_forward() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Make a commit in a feature worktreelet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("test.txt"), "test content").expect("Failed to write file");+ std::fs::write(feature_wt.join("test.txt"), "test content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "test.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add test file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Push from feature to mainsnapshot_push("push_fast_forward", &repo, &["main"], Some(&feature_wt));@@ -59,40 +59,38 @@ fn test_push_not_fast_forward() {// Create commits in both worktrees// The repo root is already the main worktree- std::fs::write(repo.root_path().join("main.txt"), "main content")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("main.txt"), "main content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add main file"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();let feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to push from feature to main (should fail - not fast-forward)snapshot_push("push_not_fast_forward", &repo, &["main"], Some(&feature_wt));@@ -110,25 +108,24 @@ fn test_push_to_default_branch() {cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();let feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Push without specifying target (should use default branch)snapshot_push("push_to_default", &repo, &[], Some(&feature_wt));@@ -141,25 +138,24 @@ fn test_push_with_dirty_target() {repo.setup_remote("main");// Make main worktree (repo root) dirty with a conflicting file- std::fs::write(repo.root_path().join("conflict.txt"), "old content")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("conflict.txt"), "old content").unwrap();let feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("conflict.txt"), "new content").expect("Failed to write file");+ std::fs::write(feature_wt.join("conflict.txt"), "new content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "conflict.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add conflict file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to push (should fail due to conflicting changes)snapshot_push(@@ -170,8 +166,7 @@ fn test_push_with_dirty_target() {);// Ensure target worktree still has original file content and no stash was created- let main_contents =- std::fs::read_to_string(repo.root_path().join("conflict.txt")).expect("read conflict file");+ let main_contents = std::fs::read_to_string(repo.root_path().join("conflict.txt")).unwrap();assert_eq!(main_contents, "old content");let mut git_cmd = Command::new("git");@@ -180,7 +175,7 @@ fn test_push_with_dirty_target() {.args(["stash", "list"]).current_dir(repo.root_path()).output()- .expect("Failed to list stashes");+ .unwrap();assert!(String::from_utf8_lossy(&stash_list.stdout).trim()@@ -195,26 +190,24 @@ fn test_push_dirty_target_autostash() {repo.setup_remote("main");// Make main worktree (repo root) dirty with a non-conflicting file- std::fs::write(repo.root_path().join("notes.txt"), "temporary notes")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("notes.txt"), "temporary notes").unwrap();let feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Push should succeed by auto-stashing the non-conflicting target changessnapshot_push(@@ -225,8 +218,7 @@ fn test_push_dirty_target_autostash() {);// Ensure the target worktree content is restored- let notes = std::fs::read_to_string(repo.root_path().join("notes.txt"))- .expect("read notes file after autostash");+ let notes = std::fs::read_to_string(repo.root_path().join("notes.txt")).unwrap();assert_eq!(notes, "temporary notes");// Autostash should clean up after itself@@ -236,7 +228,7 @@ fn test_push_dirty_target_autostash() {.args(["stash", "list"]).current_dir(repo.root_path()).output()- .expect("Failed to list stashes");+ .unwrap();assert!(String::from_utf8_lossy(&stash_list.stdout).trim()@@ -254,47 +246,45 @@ fn test_push_error_not_fast_forward() {let feature_wt = repo.add_worktree("feature", "feature");// Make a commit in the main worktree (repo root) and push it- std::fs::write(repo.root_path().join("main-file.txt"), "main content")- .expect("Failed to write file");+ std::fs::write(repo.root_path().join("main-file.txt"), "main content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "main-file.txt"]).current_dir(repo.root_path()).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Main commit"]).current_dir(repo.root_path()).output()- .expect("Failed to commit");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["push", "origin", "main"]).current_dir(repo.root_path()).output()- .expect("Failed to push");+ .unwrap();// Make a commit in feature (which doesn't have main's commit)- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Feature commit"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to push feature to main (should fail - main has commits not in feature)snapshot_push(@@ -313,21 +303,21 @@ fn test_push_error_with_merge_commits() {// Create feature branchlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Commit 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Create another branch for merginglet mut cmd = Command::new("git");@@ -335,23 +325,23 @@ fn test_push_error_with_merge_commits() {cmd.args(["checkout", "-b", "temp"]).current_dir(&feature_wt).output()- .expect("Failed to create temp branch");+ .unwrap();- std::fs::write(feature_wt.join("file2.txt"), "content2").expect("Failed to write file");+ std::fs::write(feature_wt.join("file2.txt"), "content2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file2.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Commit 2"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Switch back to feature and merge temp (creating merge commit)let mut cmd = Command::new("git");@@ -359,14 +349,14 @@ fn test_push_error_with_merge_commits() {cmd.args(["checkout", "feature"]).current_dir(&feature_wt).output()- .expect("Failed to checkout feature");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["merge", "temp", "--no-ff", "-m", "Merge temp"]).current_dir(&feature_wt).output()- .expect("Failed to merge");+ .unwrap();// Try to push to main (should fail - has merge commits)snapshot_push(@@ -385,21 +375,21 @@ fn test_push_with_merge_commits_allowed() {// Create feature branchlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("file1.txt"), "content1").expect("Failed to write file");+ std::fs::write(feature_wt.join("file1.txt"), "content1").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file1.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Commit 1"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Create another branch for merginglet mut cmd = Command::new("git");@@ -407,23 +397,23 @@ fn test_push_with_merge_commits_allowed() {cmd.args(["checkout", "-b", "temp"]).current_dir(&feature_wt).output()- .expect("Failed to create temp branch");+ .unwrap();- std::fs::write(feature_wt.join("file2.txt"), "content2").expect("Failed to write file");+ std::fs::write(feature_wt.join("file2.txt"), "content2").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "file2.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Commit 2"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Switch back to feature and merge temp (creating merge commit)let mut cmd = Command::new("git");@@ -431,14 +421,14 @@ fn test_push_with_merge_commits_allowed() {cmd.args(["checkout", "feature"]).current_dir(&feature_wt).output()- .expect("Failed to checkout feature");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["merge", "temp", "--no-ff", "-m", "Merge temp"]).current_dir(&feature_wt).output()- .expect("Failed to merge");+ .unwrap();// Push to main with --allow-merge-commits (should succeed with acknowledgment)snapshot_push(@@ -457,22 +447,21 @@ fn test_push_no_remote() {// Create a feature worktree and make a commitlet feature_wt = repo.add_worktree("feature", "feature");- std::fs::write(feature_wt.join("feature.txt"), "feature content")- .expect("Failed to write file");+ std::fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature file"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Try to push without specifying target (should fail - no remote to get default branch)snapshot_push("push_no_remote", &repo, &[], Some(&feature_wt));diff --git a/tests/integration_tests/readme_sync.rs b/tests/integration_tests/readme_sync.rsindex afa3cfe7b..61fd8142a 100644--- a/tests/integration_tests/readme_sync.rs+++ b/tests/integration_tests/readme_sync.rs@@ -17,43 +17,38 @@ static SNAPSHOT_MARKER_PATTERN: LazyLock<Regex> = LazyLock::new(|| {Regex::new(r"(?s)<!-- README:snapshot:([^\s]+) -->\n```\w*\n(?:\$ [^\n]+\n)?(.*?)```\n<!-- README:end -->",)- .expect("Invalid marker regex")+ .unwrap()});/// Regex to find README help markers (no wrapper - content is rendered markdown)static HELP_MARKER_PATTERN: LazyLock<Regex> = LazyLock::new(|| {- Regex::new(r"(?s)<!-- README:help:(.+?) -->\n(.*?)\n<!-- README:end -->")- .expect("Invalid help marker regex")+ Regex::new(r"(?s)<!-- README:help:(.+?) -->\n(.*?)\n<!-- README:end -->").unwrap()});/// Regex to strip ANSI escape codes (actual escape sequences)static ANSI_ESCAPE_REGEX: LazyLock<Regex> =- LazyLock::new(|| Regex::new(r"\x1b\[[0-9;]*m").expect("Invalid ANSI regex"));+ LazyLock::new(|| Regex::new(r"\x1b\[[0-9;]*m").unwrap());/// Regex to strip literal bracket notation (as stored in snapshots)-static ANSI_LITERAL_REGEX: LazyLock<Regex> =- LazyLock::new(|| Regex::new(r"\[[0-9;]*m").expect("Invalid literal ANSI regex"));+static ANSI_LITERAL_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\[[0-9;]*m").unwrap());/// Regex for SHA placeholder-static SHA_REGEX: LazyLock<Regex> =- LazyLock::new(|| Regex::new(r"\[SHA\]").expect("Invalid SHA regex"));+static SHA_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\[SHA\]").unwrap());/// Regex for HASH placeholder (used by shell_wrapper tests)-static HASH_REGEX: LazyLock<Regex> =- LazyLock::new(|| Regex::new(r"\[HASH\]").expect("Invalid HASH regex"));+static HASH_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\[HASH\]").unwrap());/// Regex for TMPDIR pathsstatic TMPDIR_REGEX: LazyLock<Regex> =- LazyLock::new(|| Regex::new(r"\[TMPDIR\]/test-repo\.([^\s/]+)").expect("Invalid TMPDIR regex"));+ LazyLock::new(|| Regex::new(r"\[TMPDIR\]/test-repo\.([^\s/]+)").unwrap());/// Regex for REPO placeholder-static REPO_REGEX: LazyLock<Regex> =- LazyLock::new(|| Regex::new(r"\[REPO\]").expect("Invalid REPO regex"));+static REPO_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\[REPO\]").unwrap());/// Regex to find DEFAULT_TEMPLATE markerstatic DEFAULT_TEMPLATE_PATTERN: LazyLock<Regex> = LazyLock::new(|| {Regex::new(r"(?s)(# <!-- DEFAULT_TEMPLATE_START -->\n).*?(# <!-- DEFAULT_TEMPLATE_END -->)")- .expect("Invalid DEFAULT_TEMPLATE marker regex")+ .unwrap()});/// Regex to find DEFAULT_SQUASH_TEMPLATE marker@@ -61,13 +56,13 @@ static SQUASH_TEMPLATE_PATTERN: LazyLock<Regex> = LazyLock::new(|| {Regex::new(r"(?s)(# <!-- DEFAULT_SQUASH_TEMPLATE_START -->\n).*?(# <!-- DEFAULT_SQUASH_TEMPLATE_END -->)",)- .expect("Invalid DEFAULT_SQUASH_TEMPLATE marker regex")+ .unwrap()});/// Regex to extract Rust raw string constants (single pound)static RUST_RAW_STRING_PATTERN: LazyLock<Regex> = LazyLock::new(|| {Regex::new(r##"(?s)const (DEFAULT_TEMPLATE|DEFAULT_SQUASH_TEMPLATE): &str = r#"(.*?)"#;"##)- .expect("Invalid Rust raw string regex")+ .unwrap()});/// Strip ANSI escape codes from text@@ -329,9 +324,8 @@ fn test_config_example_templates_are_in_sync() {let llm_rs_path = project_root.join("src/llm.rs");let config_path = project_root.join("dev/config.example.toml");- let llm_content = fs::read_to_string(&llm_rs_path).expect("Failed to read src/llm.rs");- let config_content =- fs::read_to_string(&config_path).expect("Failed to read config.example.toml");+ let llm_content = fs::read_to_string(&llm_rs_path).unwrap();+ let config_content = fs::read_to_string(&config_path).unwrap();// Extract templates from llm.rslet templates = extract_templates(&llm_content);@@ -381,7 +375,7 @@ fn test_config_example_templates_are_in_sync() {);if updated_count > 0 {- fs::write(&config_path, &updated_content).expect("Failed to write config.example.toml");+ fs::write(&config_path, &updated_content).unwrap();println!("✅ Updated {} template sections in config.example.toml",updated_count@@ -394,7 +388,7 @@ fn test_readme_examples_are_in_sync() {let project_root = Path::new(env!("CARGO_MANIFEST_DIR"));let readme_path = project_root.join("README.md");- let readme_content = fs::read_to_string(&readme_path).expect("Failed to read README.md");+ let readme_content = fs::read_to_string(&readme_path).unwrap();let mut errors = Vec::new();let mut checked = 0;@@ -449,7 +443,7 @@ fn test_readme_examples_are_in_sync() {// Write updatesif total_updated > 0 {- fs::write(&readme_path, &updated_content).expect("Failed to write README.md");+ fs::write(&readme_path, &updated_content).unwrap();println!("✅ Updated {} sections in README.md", total_updated);}diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rsindex cd826177d..50096c090 100644--- a/tests/integration_tests/remove.rs+++ b/tests/integration_tests/remove.rs@@ -48,7 +48,7 @@ fn test_remove_switch_to_default() {cmd.args(["switch", "-c", "feature"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();snapshot_remove("remove_switch_to_default", &repo, &[], None);}@@ -83,8 +83,7 @@ fn test_remove_dirty_working_tree() {let repo = setup_remove_repo();// Create a dirty file- std::fs::write(repo.root_path().join("dirty.txt"), "uncommitted changes")- .expect("Failed to create file");+ std::fs::write(repo.root_path().join("dirty.txt"), "uncommitted changes").unwrap();snapshot_remove("remove_dirty_working_tree", &repo, &[], None);}@@ -147,8 +146,7 @@ fn test_remove_by_name_dirty_target() {let worktree_path = repo.add_worktree("feature-dirty", "feature-dirty");// Create a dirty file in the target worktree- std::fs::write(worktree_path.join("dirty.txt"), "uncommitted changes")- .expect("Failed to create file");+ std::fs::write(worktree_path.join("dirty.txt"), "uncommitted changes").unwrap();// Try to remove it by name from main reposnapshot_remove(@@ -203,16 +201,15 @@ fn test_remove_branch_not_fully_merged() {let worktree_path = repo.add_worktree("feature-unmerged", "feature-unmerged");// Add a commit to the feature branch that's not in main- std::fs::write(worktree_path.join("feature.txt"), "new feature")- .expect("Failed to create file");+ std::fs::write(worktree_path.join("feature.txt"), "new feature").unwrap();repo.git_command(&["add", "feature.txt"]).current_dir(&worktree_path).output()- .expect("Failed to stage file");+ .unwrap();repo.git_command(&["commit", "-m", "Add feature"]).current_dir(&worktree_path).output()- .expect("Failed to commit");+ .unwrap();// Try to remove it from the main repo// Branch deletion should fail but worktree removal should succeeddiff --git a/tests/integration_tests/security.rs b/tests/integration_tests/security.rsindex 22e1b6aea..8737dcd31 100644--- a/tests/integration_tests/security.rs+++ b/tests/integration_tests/security.rs@@ -261,7 +261,7 @@ fn test_branch_name_is_directive_not_executed() {cmd.args(["branch", malicious_branch]).current_dir(repo.root_path());- let result = cmd.output().expect("Failed to run git branch");+ let result = cmd.output().unwrap();if !result.status.success() {// Git rejected the malicious branch name@@ -304,7 +304,7 @@ fn test_branch_name_with_newline_directive_not_executed() {cmd.args(["branch", malicious_branch]).current_dir(repo.root_path());- let result = cmd.output().expect("Failed to run git branch");+ let result = cmd.output().unwrap();if !result.status.success() {return;@@ -382,7 +382,7 @@ fn test_path_with_directive_not_executed() {let malicious_dir = repo.root_path().join("__WORKTRUNK_EXEC__echo PWNED > /tmp/hacked5");- std::fs::create_dir_all(&malicious_dir).expect("Failed to create malicious directory");+ std::fs::create_dir_all(&malicious_dir).unwrap();let settings = setup_snapshot_settings(&repo);@@ -417,7 +417,7 @@ fn test_branch_name_with_cd_directive_not_executed() {cmd.args(["branch", malicious_branch]).current_dir(repo.root_path());- let result = cmd.output().expect("Failed to run git branch");+ let result = cmd.output().unwrap();if !result.status.success() {// Git rejected it - that's fine, nothing to test@@ -490,7 +490,7 @@ fn test_execute_flag_with_directive_like_branch_name() {cmd.args(["branch", malicious_branch]).current_dir(repo.root_path());- let result = cmd.output().expect("Failed to run git branch");+ let result = cmd.output().unwrap();if !result.status.success() {// Git rejected the branch namediff --git a/tests/integration_tests/shell_wrapper.rs b/tests/integration_tests/shell_wrapper.rsindex 4bf38d400..9041741f5 100644--- a/tests/integration_tests/shell_wrapper.rs+++ b/tests/integration_tests/shell_wrapper.rs@@ -44,14 +44,13 @@ static TMPDIR_REGEX: LazyLock<regex::Regex> = LazyLock::new(|| {regex::Regex::new(r#"(/private/var/folders/[^/]+/[^/]+/T/\.tmp[^\s/'"]+|/tmp/\.(?:tmp|psub)[^\s/'"]+)"#,)- .expect("Invalid tmpdir regex pattern")+ .unwrap()});/// Regex that collapses repeated TMPDIR placeholders (caused by nested mktemp paths)/// so `[TMPDIR][TMPDIR]/foo` becomes `[TMPDIR]/foo` and `[TMPDIR]/[TMPDIR]` becomes `[TMPDIR]`-static TMPDIR_PLACEHOLDER_COLLAPSE_REGEX: LazyLock<regex::Regex> = LazyLock::new(|| {- regex::Regex::new(r"\[TMPDIR](?:/?\[TMPDIR])+").expect("Invalid TMPDIR placeholder regex")-});+static TMPDIR_PLACEHOLDER_COLLAPSE_REGEX: LazyLock<regex::Regex> =+ LazyLock::new(|| regex::Regex::new(r"\[TMPDIR](?:/?\[TMPDIR])+").unwrap());/// Regex for normalizing workspace paths (dynamically built from CARGO_MANIFEST_DIR)/// Matches: <project_root>/tests/fixtures/@@ -59,14 +58,14 @@ static TMPDIR_PLACEHOLDER_COLLAPSE_REGEX: LazyLock<regex::Regex> = LazyLock::newstatic WORKSPACE_REGEX: LazyLock<regex::Regex> = LazyLock::new(|| {let manifest_dir = env!("CARGO_MANIFEST_DIR");let pattern = format!(r"{}/tests/fixtures/", regex::escape(manifest_dir));- regex::Regex::new(&pattern).expect("Invalid workspace regex pattern")+ regex::Regex::new(&pattern).unwrap()});/// Regex for normalizing git commit hashes (7-character hex)/// Matches 7-character lowercase hex sequences (git short hashes)/// Note: No word boundaries because ANSI codes (ending with 'm') directly precede hashesstatic COMMIT_HASH_REGEX: LazyLock<regex::Regex> =- LazyLock::new(|| regex::Regex::new(r"[0-9a-f]{7}").expect("Invalid commit hash regex pattern"));+ LazyLock::new(|| regex::Regex::new(r"[0-9a-f]{7}").unwrap());/// Output from executing a command through a shell wrapper#[derive(Debug)]@@ -79,9 +78,8 @@ struct ShellOutput {/// Regex for detecting bash job control messages/// Matches patterns like "[1] 12345" (job start) and "[1]+ Done" (job completion)-static JOB_CONTROL_REGEX: LazyLock<regex::Regex> = LazyLock::new(|| {- regex::Regex::new(r"\[\d+\][+-]?\s+(Done|\d+)").expect("Invalid job control regex pattern")-});+static JOB_CONTROL_REGEX: LazyLock<regex::Regex> =+ LazyLock::new(|| regex::Regex::new(r"\[\d+\][+-]?\s+(Done|\d+)").unwrap());impl ShellOutput {/// Check if output contains no directive leaks@@ -307,7 +305,7 @@ fn exec_in_pty_interactive(pixel_width: 0,pixel_height: 0,})- .expect("Failed to open PTY");+ .unwrap();// Spawn the shell inside the PTYlet mut cmd = CommandBuilder::new(shell);@@ -318,10 +316,7 @@ fn exec_in_pty_interactive(// Set minimal required environment for shells to functioncmd.env("HOME",- home::home_dir()- .expect("HOME directory required")- .to_string_lossy()- .to_string(),+ home::home_dir().unwrap().to_string_lossy().to_string(),);cmd.env("PATH",@@ -357,37 +352,27 @@ fn exec_in_pty_interactive(cmd.env(key, value);}- let mut child = pair- .slave- .spawn_command(cmd)- .expect("Failed to spawn command in PTY");+ let mut child = pair.slave.spawn_command(cmd).unwrap();drop(pair.slave); // Close slave in parent// Clone the reader for capturing output- let mut reader = pair- .master- .try_clone_reader()- .expect("Failed to clone PTY reader");+ let mut reader = pair.master.try_clone_reader().unwrap();// Write input synchronously if we have any (matches approval_pty.rs approach)if !inputs.is_empty() {- let mut writer = pair.master.take_writer().expect("Failed to get PTY writer");+ let mut writer = pair.master.take_writer().unwrap();for input in inputs {- writer- .write_all(input.as_bytes())- .expect("Failed to write input to PTY");- writer.flush().expect("Failed to flush PTY writer");+ writer.write_all(input.as_bytes()).unwrap();+ writer.flush().unwrap();}drop(writer); // Explicitly drop writer so PTY sees EOF}// Read everything the "terminal" would display (including echoed input)let mut buf = String::new();- reader- .read_to_string(&mut buf)- .expect("Failed to read from PTY"); // Blocks until child exits & PTY closes+ reader.read_to_string(&mut buf).unwrap(); // Blocks until child exits & PTY closes- let status = child.wait().expect("Failed to wait for child process");+ let status = child.wait().unwrap();(normalize_newlines(&buf), status.exit_code() as i32)}@@ -744,7 +729,7 @@ mod tests {// Create project config with both post-create and post-start hookslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"# Blocking command that runs before worktree is ready@@ -759,7 +744,7 @@ server = "echo 'Starting dev server on port 3000'"watch = "echo 'Watching for file changes'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add hooks");@@ -777,7 +762,7 @@ approved-commands = []"#,)- .expect("Failed to write user config");+ .unwrap();let output = exec_through_wrapper(shell, &repo, "switch", &["--create", "feature-hooks"]);@@ -802,7 +787,7 @@ approved-commands = [// Create project config with pre-merge validationlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"[pre-merge-command]@@ -811,7 +796,7 @@ lint = "echo '✓ Linting passed - no warnings'"test = "echo '✓ All 47 tests passed in 2.3s'""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add pre-merge validation");@@ -822,25 +807,25 @@ test = "echo '✓ All 47 tests passed in 2.3s'"cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add main worktree");+ .unwrap();// Create feature worktree with a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Pre-approve commandsfs::write(@@ -855,7 +840,7 @@ approved-commands = []"#,)- .expect("Failed to write user config");+ .unwrap();// Run merge from the feature worktreelet output =@@ -884,7 +869,7 @@ approved-commands = [// Create project config with failing pre-merge validationlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"[pre-merge-command]@@ -892,7 +877,7 @@ format = "echo '✓ Code formatting check passed'"test = "echo '✗ Test suite failed: 3 tests failing' && exit 1""#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add failing pre-merge validation");@@ -903,25 +888,25 @@ test = "echo '✗ Test suite failed: 3 tests failing' && exit 1"cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add main worktree");+ .unwrap();// Create feature worktree with a commitlet feature_wt = repo.add_worktree("feature-fail", "feature-fail");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Pre-approve the commandsfs::write(@@ -935,7 +920,7 @@ approved-commands = []"#,)- .expect("Failed to write user config");+ .unwrap();// Run merge from the feature worktreelet output =@@ -968,7 +953,7 @@ approved-commands = [// Create project config with pre-merge commands that output to both stdout and stderrlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),format!(@@ -980,7 +965,7 @@ check2 = "{} check2 3"script_path.display()),)- .expect("Failed to write config");+ .unwrap();repo.commit("Add pre-merge validation with mixed output");@@ -991,25 +976,25 @@ check2 = "{} check2 3"cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add main worktree");+ .unwrap();// Create feature worktree with a commitlet feature_wt = repo.add_worktree("feature", "feature");- fs::write(feature_wt.join("feature.txt"), "feature content").expect("Failed to write file");+ fs::write(feature_wt.join("feature.txt"), "feature content").unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "feature.txt"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add feature"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Pre-approve commandsfs::write(@@ -1027,7 +1012,7 @@ approved-commands = [script_path.display()),)- .expect("Failed to write user config");+ .unwrap();// Run merge from the feature worktreelet output =@@ -1058,12 +1043,12 @@ approved-commands = [// Configure a post-start command in the project config (this is where the bug manifests)// The println! in handle_post_start_commands causes directive leakslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "echo 'test command executed'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add post-start command");@@ -1076,7 +1061,7 @@ approved-commands = [approved-commands = ["echo 'test command executed'"]"#,)- .expect("Failed to write user config");+ .unwrap();let output =exec_through_wrapper("bash", &repo, "switch", &["--create", "feature-with-hooks"]);@@ -1178,12 +1163,12 @@ approved-commands = ["echo 'test command executed'"]// Configure a post-start background command that will trigger progress outputlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "echo 'background task'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add post-start command");@@ -1196,7 +1181,7 @@ approved-commands = ["echo 'test command executed'"]approved-commands = ["echo 'background task'"]"#,)- .expect("Failed to write user config");+ .unwrap();let output = exec_through_wrapper("bash", &repo, "switch", &["--create", "feature-bg"]);@@ -1247,12 +1232,12 @@ approved-commands = ["echo 'background task'"]// Configure a post-start background command that will trigger progress outputlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "echo 'fish background task'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add post-start command");@@ -1265,7 +1250,7 @@ approved-commands = ["echo 'background task'"]approved-commands = ["echo 'fish background task'"]"#,)- .expect("Failed to write user config");+ .unwrap();let output = exec_through_wrapper("fish", &repo, "switch", &["--create", "fish-bg"]);@@ -1375,10 +1360,7 @@ approved-commands = ["echo 'fish background task'"]// Get the worktrunk source directory (where this test is running from)// This is the directory that contains Cargo.toml with the workspace- let worktrunk_source = env::current_dir()- .expect("Failed to get current directory")- .canonicalize()- .expect("Failed to canonicalize path");+ let worktrunk_source = env::current_dir().unwrap().canonicalize().unwrap();// Build a shell script that runs from the worktrunk source directorylet wt_bin = get_cargo_bin("wt");@@ -1494,12 +1476,12 @@ approved-commands = ["echo 'fish background task'"]// Configure a post-start command that will trigger background joblet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "echo 'background job'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add post-start command");@@ -1512,7 +1494,7 @@ approved-commands = ["echo 'fish background task'"]approved-commands = ["echo 'background job'"]"#,)- .expect("Failed to write user config");+ .unwrap();let output = exec_through_wrapper("zsh", &repo, "switch", &["--create", "zsh-job-test"]);@@ -1543,12 +1525,12 @@ approved-commands = ["echo 'background job'"]// Configure a post-start command that will trigger background joblet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "echo 'bash background'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add post-start command");@@ -1561,7 +1543,7 @@ approved-commands = ["echo 'background job'"]approved-commands = ["echo 'bash background'"]"#,)- .expect("Failed to write user config");+ .unwrap();let output = exec_through_wrapper("bash", &repo, "switch", &["--create", "bash-job-test"]);@@ -1940,12 +1922,12 @@ approved-commands = ["echo 'bash background'"]// Configure a post-start command to exercise the background job code pathlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-command = "echo 'cleanup test'""#,)- .expect("Failed to write project config");+ .unwrap();repo.commit("Add post-start command");@@ -1958,7 +1940,7 @@ approved-commands = ["echo 'bash background'"]approved-commands = ["echo 'cleanup test'"]"#,)- .expect("Failed to write user config");+ .unwrap();// Run a command that exercises the full FIFO/background job code pathlet output = exec_through_wrapper(shell, &repo, "switch", &["--create", "cleanup-test"]);@@ -2004,11 +1986,11 @@ approved-commands = ["echo 'cleanup test'"]// Create project config with pre-merge hookslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();// Create mock commands for realistic outputlet bin_dir = repo.root_path().join(".bin");- fs::create_dir_all(&bin_dir).expect("Failed to create bin dir");+ fs::create_dir_all(&bin_dir).unwrap();// Mock pytest commandlet pytest_script = r#"#!/bin/sh@@ -2026,7 +2008,7 @@ tests/test_auth.py::test_token_validation PASSED [100%]EOFexit 0"#;- fs::write(bin_dir.join("pytest"), pytest_script).expect("Failed to write pytest script");+ fs::write(bin_dir.join("pytest"), pytest_script).unwrap();// Mock ruff commandlet ruff_script = r#"#!/bin/sh@@ -2040,7 +2022,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("ruff"), ruff_script).expect("Failed to write ruff script");+ fs::write(bin_dir.join("ruff"), ruff_script).unwrap();// Mock llm command for commit messagelet llm_script = r#"#!/bin/sh@@ -2052,7 +2034,7 @@ Implement login and token refresh endpoints with JWT validation.Includes comprehensive test coverage and input validation.EOF"#;- fs::write(bin_dir.join("llm"), llm_script).expect("Failed to write llm script");+ fs::write(bin_dir.join("llm"), llm_script).unwrap();// Mock uv command for running pytest and rufflet uv_script = r#"#!/bin/sh@@ -2066,7 +2048,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("uv"), uv_script).expect("Failed to write uv script");+ fs::write(bin_dir.join("uv"), uv_script).unwrap();// Make scripts executable (Unix only)#[cfg(unix)]@@ -2085,8 +2067,7 @@ fi"lint" = "uv run ruff check""#;- fs::write(config_dir.join("wt.toml"), config_content)- .expect("Failed to write project config");+ fs::write(config_dir.join("wt.toml"), config_content).unwrap();// Commit the configlet mut cmd = Command::new("git");@@ -2094,14 +2075,14 @@ ficmd.args(["add", ".config/wt.toml", ".bin"]).current_dir(repo.root_path()).output()- .expect("Failed to add config");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add pre-merge hooks"]).current_dir(repo.root_path()).output()- .expect("Failed to commit config");+ .unwrap();// Create a worktree for mainlet main_wt = repo.root_path().parent().unwrap().join("test-repo.main-wt");@@ -2110,13 +2091,13 @@ ficmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"]).current_dir(repo.root_path()).output()- .expect("Failed to add worktree");+ .unwrap();// Create a feature worktree and make multiple commitslet feature_wt = repo.add_worktree("feature-auth", "feature-auth");// First commit - create initial auth.py with login endpoint- fs::create_dir_all(feature_wt.join("api")).expect("Failed to create api dir");+ fs::create_dir_all(feature_wt.join("api")).unwrap();let auth_py_v1 = r#"# Authentication API endpointsfrom typing import Dict, Optionalimport jwt@@ -2136,22 +2117,22 @@ def login(username: str, password: str) -> Optional[Dict]:token = jwt.encode(payload, 'secret', algorithm='HS256')return {'token': token, 'expires_in': 3600}"#;- std::fs::write(feature_wt.join("api/auth.py"), auth_py_v1).expect("Failed to write file");+ std::fs::write(feature_wt.join("api/auth.py"), auth_py_v1).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "api/auth.py"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add login endpoint"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Second commit - add tests- fs::create_dir_all(feature_wt.join("tests")).expect("Failed to create tests dir");+ fs::create_dir_all(feature_wt.join("tests")).unwrap();let test_auth_py = r#"# Authentication endpoint testsimport pytestfrom api.auth import login@@ -2167,20 +2148,19 @@ def test_login_invalid_password():def test_token_validation():assert login('valid_user', 'valid_pass')['expires_in'] == 3600"#;- std::fs::write(feature_wt.join("tests/test_auth.py"), test_auth_py)- .expect("Failed to write file");+ std::fs::write(feature_wt.join("tests/test_auth.py"), test_auth_py).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "tests/test_auth.py"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add authentication tests"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Third commit - add refresh endpointlet auth_py_v2 = r#"# Authentication API endpoints@@ -2215,19 +2195,19 @@ def refresh_token(token: str) -> Optional[Dict]:except jwt.InvalidTokenError:return None"#;- std::fs::write(feature_wt.join("api/auth.py"), auth_py_v2).expect("Failed to write file");+ std::fs::write(feature_wt.join("api/auth.py"), auth_py_v2).unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "api/auth.py"]).current_dir(&feature_wt).output()- .expect("Failed to add file");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add validation"]).current_dir(&feature_wt).output()- .expect("Failed to commit");+ .unwrap();// Configure LLM in worktrunk configlet llm_path = bin_dir.join("llm");@@ -2239,8 +2219,7 @@ command = "{}""#,llm_path.display());- fs::write(repo.test_config_path(), worktrunk_config)- .expect("Failed to write worktrunk config");+ fs::write(repo.test_config_path(), worktrunk_config).unwrap();// Set PATH with mock binaries and run mergelet path_with_bin = format!(@@ -2279,11 +2258,11 @@ command = "{}"// Create project config with post-create and post-start hookslet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();// Create mock commands for realistic outputlet bin_dir = repo.root_path().join(".bin");- fs::create_dir_all(&bin_dir).expect("Failed to create bin dir");+ fs::create_dir_all(&bin_dir).unwrap();// Mock uv command that simulates dependency installationlet uv_script = r#"#!/bin/sh@@ -2301,7 +2280,7 @@ elseexit 1fi"#;- fs::write(bin_dir.join("uv"), uv_script).expect("Failed to write uv script");+ fs::write(bin_dir.join("uv"), uv_script).unwrap();// Make scripts executable (Unix only)#[cfg(unix)]@@ -2320,8 +2299,7 @@ fi"dev" = "uv run dev""#;- fs::write(config_dir.join("wt.toml"), config_content)- .expect("Failed to write project config");+ fs::write(config_dir.join("wt.toml"), config_content).unwrap();// Commit the configlet mut cmd = Command::new("git");@@ -2329,14 +2307,14 @@ ficmd.args(["add", ".config/wt.toml", ".bin"]).current_dir(repo.root_path()).output()- .expect("Failed to add config");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["commit", "-m", "Add project hooks"]).current_dir(repo.root_path()).output()- .expect("Failed to commit config");+ .unwrap();// Set PATH with mock binaries and run switch --createlet path_with_bin = format!(@@ -2391,7 +2369,7 @@ test = "echo 'Running tests...'"pixel_width: 0,pixel_height: 0,})- .expect("Failed to open PTY");+ .unwrap();let cargo_bin = get_cargo_bin("wt");let mut cmd = CommandBuilder::new(cargo_bin);@@ -2404,10 +2382,7 @@ test = "echo 'Running tests...'"cmd.env_clear();cmd.env("HOME",- home::home_dir()- .expect("HOME directory required")- .to_string_lossy()- .to_string(),+ home::home_dir().unwrap().to_string_lossy().to_string(),);cmd.env("PATH",@@ -2417,31 +2392,21 @@ test = "echo 'Running tests...'"cmd.env(key, value);}- let mut child = pair- .slave- .spawn_command(cmd)- .expect("Failed to spawn command in PTY");+ let mut child = pair.slave.spawn_command(cmd).unwrap();drop(pair.slave);- let mut reader = pair- .master- .try_clone_reader()- .expect("Failed to clone PTY reader");- let mut writer = pair.master.take_writer().expect("Failed to get PTY writer");+ let mut reader = pair.master.try_clone_reader().unwrap();+ let mut writer = pair.master.take_writer().unwrap();// Send "n" to decline and complete the command- writer- .write_all(b"n\n")- .expect("Failed to write input to PTY");- writer.flush().expect("Failed to flush PTY writer");+ writer.write_all(b"n\n").unwrap();+ writer.flush().unwrap();drop(writer);// Read all outputlet mut buf = String::new();- reader- .read_to_string(&mut buf)- .expect("Failed to read PTY output");- child.wait().expect("Failed to wait for child");+ reader.read_to_string(&mut buf).unwrap();+ child.wait().unwrap();// Normalize: strip ANSI codes and control characterslet ansi_regex = regex::Regex::new(r"\x1b\[[0-9;]*m").unwrap();diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rsindex 60fb1f10d..10d8f564d 100644--- a/tests/integration_tests/switch.rs+++ b/tests/integration_tests/switch.rs@@ -79,14 +79,14 @@ fn test_switch_create_with_remote_branch_only() {cmd.args(["branch", "remote-feature"]).current_dir(repo.root_path()).output()- .expect("Failed to create branch");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["push", "origin", "remote-feature"]).current_dir(repo.root_path()).output()- .expect("Failed to push to remote");+ .unwrap();// Delete the local branchlet mut cmd = Command::new("git");@@ -94,7 +94,7 @@ fn test_switch_create_with_remote_branch_only() {cmd.args(["branch", "-D", "remote-feature"]).current_dir(repo.root_path()).output()- .expect("Failed to delete local branch");+ .unwrap();// Now we have origin/remote-feature but no local remote-feature// This should succeed with --create (previously would fail)@@ -187,7 +187,7 @@ fn test_switch_error_missing_worktree_directory() {let wt_path = repo.add_worktree("missing-wt", "missing-wt");// Remove the worktree directory (but leave it registered in git)- std::fs::remove_dir_all(&wt_path).expect("Failed to remove worktree directory");+ std::fs::remove_dir_all(&wt_path).unwrap();// Try to switch to the missing worktree (should fail)snapshot_switch("switch_error_missing_directory", &repo, &["missing-wt"]);@@ -284,7 +284,7 @@ fn test_switch_no_config_commands_skips_post_start_commands() {// Create project config with a command that would create a filelet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();let create_file_cmd = "echo 'marker' > marker.txt";@@ -292,13 +292,13 @@ fn test_switch_no_config_commands_skips_post_start_commands() {config_dir.join("wt.toml"),format!(r#"post-start-commands = ["{}"]"#, create_file_cmd),)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");// Pre-approve the commandlet user_config_dir = temp_home.path().join(".config/worktrunk");- fs::create_dir_all(&user_config_dir).expect("Failed to create user config dir");+ fs::create_dir_all(&user_config_dir).unwrap();fs::write(user_config_dir.join("config.toml"),format!(@@ -310,7 +310,7 @@ approved-commands = ["{}"]create_file_cmd),)- .expect("Failed to write user config");+ .unwrap();// With --no-hooks, the post-start command should be skippedsnapshot_switch_with_home(@@ -352,12 +352,12 @@ fn test_switch_no_config_commands_with_force() {// Create project config with a commandlet config_dir = repo.root_path().join(".config");- fs::create_dir_all(&config_dir).expect("Failed to create .config dir");+ fs::create_dir_all(&config_dir).unwrap();fs::write(config_dir.join("wt.toml"),r#"post-start-commands = ["echo 'test'"]"#,)- .expect("Failed to write config");+ .unwrap();repo.commit("Add config");@@ -417,14 +417,14 @@ fn test_switch_previous_branch() {cmd.args(["branch", "feature-a"]).current_dir(repo.root_path()).output()- .expect("Failed to create feature-a");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["branch", "feature-b"]).current_dir(repo.root_path()).output()- .expect("Failed to create feature-b");+ .unwrap();// Use wt switch to establish worktrunk.historysnapshot_switch("switch_previous_branch_first", &repo, &["feature-a"]);@@ -454,14 +454,14 @@ fn test_switch_previous_branch_with_worktrunk_history() {cmd.args(["branch", "feature-x"]).current_dir(repo.root_path()).output()- .expect("Failed to create feature-x");+ .unwrap();let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["branch", "feature-y"]).current_dir(repo.root_path()).output()- .expect("Failed to create feature-y");+ .unwrap();// Use wt switch to switch to feature-x (this records history)snapshot_switch(@@ -497,7 +497,7 @@ fn test_switch_main_branch() {cmd.args(["branch", "feature-a"]).current_dir(repo.root_path()).output()- .expect("Failed to create feature-a");+ .unwrap();// Switch to feature-a firstsnapshot_switch("switch_main_branch_to_feature", &repo, &["feature-a"]);