Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Add --clobber flag to wt switch for backing up stale paths (#242)
Maximilian Roos7b958dc7be1e
diff --git a/docs/content/switch.md b/docs/content/switch.mdindex eeffbb087..d3c7572e5 100644--- a/docs/content/switch.md+++ b/docs/content/switch.md@@ -105,6 +105,9 @@ Options:-f, --forceSkip approval prompts+ --clobber+ Remove stale paths at target+--no-verifySkip hooksdiff --git a/src/cli.rs b/src/cli.rsindex 09fa10e79..13ba0de5a 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -2109,6 +2109,10 @@ If the expected path is occupied by a different branch's worktree, an error is r#[arg(short = 'f', long)]force: bool,+ /// Remove stale paths at target+ #[arg(long)]+ clobber: bool,+/// Skip hooks#[arg(long = "no-verify", action = clap::ArgAction::SetFalse, default_value_t = true)]verify: bool,diff --git a/src/commands/select.rs b/src/commands/select.rsindex f7a87c0e9..5b939e45c 100644--- a/src/commands/select.rs+++ b/src/commands/select.rs@@ -974,7 +974,8 @@ pub fn handle_select(is_directive_mode: bool) -> anyhow::Result<()> {// Switch to the selected worktree// handle_switch can handle both branch names and worktree paths- let (result, branch_info) = handle_switch(&identifier, false, None, false, false, &config)?;+ let (result, branch_info) =+ handle_switch(&identifier, false, None, false, false, false, &config)?;// Clear the terminal screen after skim exits to prevent artifacts// Use stderr for terminal control sequences - in directive mode, stdout goes to a FIFOdiff --git a/src/commands/worktree.rs b/src/commands/worktree.rsindex 63cf47ec7..733cdf0f6 100644--- a/src/commands/worktree.rs+++ b/src/commands/worktree.rs@@ -126,6 +126,28 @@ use super::command_executor::CommandContext;use super::hooks::{HookFailureStrategy, HookPipeline, HookSource};use super::repository_ext::RepositoryCliExt;+/// Generate a backup path for the given path with a timestamp suffix.+///+/// For paths with extensions: `file.txt` → `file.txt.bak.TIMESTAMP`+/// For paths without extensions: `foo` → `foo.bak.TIMESTAMP`+fn generate_backup_path(path: &std::path::Path, suffix: &str) -> PathBuf {+ if path.extension().is_none() {+ // Path has no extension (e.g., /repo/feature)+ path.with_file_name(format!(+ "{}.bak.{suffix}",+ path.file_name().unwrap().to_string_lossy()+ ))+ } else {+ // Path has an extension (e.g., /repo.feature or /file.txt)+ path.with_extension(format!(+ "{}.bak.{suffix}",+ path.extension()+ .map(|e| e.to_string_lossy().to_string())+ .unwrap_or_default()+ ))+ }+}+/// Context for worktree resolution - determines which checks are performed.#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub enum ResolutionContext {@@ -413,6 +435,7 @@ pub fn handle_switch(create: bool,base: Option<&str>,force: bool,+ clobber: bool,no_verify: bool,config: &WorktrunkConfig,) -> anyhow::Result<(SwitchResult, SwitchBranchInfo)> {@@ -533,12 +556,40 @@ pub fn handle_switch(let worktree_path = expected_path;// If the target path already exists but is NOT a worktree (e.g., stale directory),- // surface a helpful error instead of letting git fail with "already exists".+ // either move it to .bak (with --clobber) or surface a helpful error.if worktree_path.exists() {- return Err(GitError::WorktreePathExists {- path: worktree_path,+ if clobber {+ use anyhow::Context;++ // Generate timestamped backup path+ let timestamp = crate::display::get_now();+ let datetime =+ chrono::DateTime::from_timestamp(timestamp, 0).unwrap_or_else(chrono::Utc::now);+ let suffix = datetime.format("%Y%m%d-%H%M%S").to_string();+ let backup_path = generate_backup_path(&worktree_path, &suffix);++ // Error if backup path already exists+ if backup_path.exists() {+ anyhow::bail!(+ "Backup path already exists: {}",+ worktrunk::path::format_path_for_display(&backup_path)+ );+ }++ let path_display = worktrunk::path::format_path_for_display(&worktree_path);+ let backup_display = worktrunk::path::format_path_for_display(&backup_path);+ crate::output::print(warning_message(cformat!(+ "Moving <bold>{path_display}</> to <bold>{backup_display}</> (<bright-black>--clobber</>)"+ )))?;++ std::fs::rename(&worktree_path, &backup_path)+ .with_context(|| format!("Failed to move {path_display} to {backup_display}"))?;+ } else {+ return Err(GitError::WorktreePathExists {+ path: worktree_path,+ }+ .into());}- .into());}// Create the worktree@@ -1183,4 +1234,34 @@ mod tests {_ => panic!("Expected RemovedWorktree variant"),}}++ #[test]+ fn test_generate_backup_path_with_extension() {+ // Paths with extensions: file.txt -> file.txt.bak.TIMESTAMP+ let path = PathBuf::from("/tmp/repo.feature");+ let backup = super::generate_backup_path(&path, "20250101-000000");+ assert_eq!(+ backup,+ PathBuf::from("/tmp/repo.feature.bak.20250101-000000")+ );++ let path = PathBuf::from("/tmp/file.txt");+ let backup = super::generate_backup_path(&path, "20250101-000000");+ assert_eq!(backup, PathBuf::from("/tmp/file.txt.bak.20250101-000000"));+ }++ #[test]+ fn test_generate_backup_path_without_extension() {+ // Paths without extensions: foo -> foo.bak.TIMESTAMP+ let path = PathBuf::from("/tmp/repo/feature");+ let backup = super::generate_backup_path(&path, "20250101-000000");+ assert_eq!(+ backup,+ PathBuf::from("/tmp/repo/feature.bak.20250101-000000")+ );++ let path = PathBuf::from("/tmp/mydir");+ let backup = super::generate_backup_path(&path, "20250101-000000");+ assert_eq!(backup, PathBuf::from("/tmp/mydir.bak.20250101-000000"));+ }}diff --git a/src/display.rs b/src/display.rsindex f6bd43e06..4a1cf1ea3 100644--- a/src/display.rs+++ b/src/display.rs@@ -16,7 +16,7 @@ pub fn format_relative_time_short(timestamp: i64) -> String {}/// Get current time, respecting SOURCE_DATE_EPOCH for reproducible builds/tests-fn get_now() -> i64 {+pub fn get_now() -> i64 {std::env::var("SOURCE_DATE_EPOCH").ok().and_then(|val| val.parse::<i64>().ok())diff --git a/src/git/error.rs b/src/git/error.rsindex 941c5a15c..5be747ea0 100644--- a/src/git/error.rs+++ b/src/git/error.rs@@ -258,7 +258,7 @@ impl std::fmt::Display for GitError {"Directory already exists: <bold>{path_display}</>")),hint_message(cformat!(- "Remove with <bright-black>rm -rf {path_display}</> or use a different branch name"+ "Use <bright-black>--clobber</> to remove, or <bright-black>rm -rf {path_display}</>")))}@@ -705,7 +705,7 @@ mod tests {assert_snapshot!(err.to_string(), @r"❌ [31mDirectory already exists: [1m/some/path[22m[39m- 💡 [2mRemove with [90mrm -rf /some/path[39m or use a different branch name[22m+ 💡 [2mUse [90m--clobber[39m to remove, or [90mrm -rf /some/path[39m[22m");}diff --git a/src/main.rs b/src/main.rsindex 0cdb5a3ca..b1a546160 100644--- a/src/main.rs+++ b/src/main.rs@@ -1185,6 +1185,7 @@ fn main() {base,execute,force,+ clobber,verify,} => WorktrunkConfig::load().context("Failed to load config")@@ -1221,8 +1222,15 @@ fn main() {}// Execute switch operation (creates worktree, runs post-create hooks if approved)- let (result, branch_info) =- handle_switch(&branch, create, base.as_deref(), force, skip_hooks, &config)?;+ let (result, branch_info) = handle_switch(+ &branch,+ create,+ base.as_deref(),+ force,+ clobber,+ skip_hooks,+ &config,+ )?;// Show success message (temporal locality: immediately after worktree creation)// Pass cli.internal to indicate whether shell integration is activediff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snapindex 829bea2e2..5a7d91f44 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap@@ -1,8 +1,7 @@----source: tests/git_error_display.rs-assertion_line: 66+source: tests/integration_tests/git_error_display.rsexpression: err.to_string()---❌ [31mDirectory already exists: [1m/tmp/repo.feature[22m[39m-💡 [2mRemove with [90mrm -rf /tmp/repo.feature[39m or use a different branch name[22m+💡 [2mUse [90m--clobber[39m to remove, or [90mrm -rf /tmp/repo.feature[39m[22mdiff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rsindex dc0a0f7ae..d1c2f0368 100644--- a/tests/integration_tests/switch.rs+++ b/tests/integration_tests/switch.rs@@ -808,3 +808,169 @@ fn test_switch_outside_git_repo(temp_home: TempDir) {assert_cmd_snapshot!(cmd);});}++// Clobber flag path backup tests++/// Test --clobber moves stale directory to .bak and creates worktree+#[rstest]+fn test_switch_clobber_backs_up_stale_directory(repo: TestRepo) {+ // Calculate where the worktree would be created+ let repo_name = repo.root_path().file_name().unwrap().to_str().unwrap();+ let expected_path = repo+ .root_path()+ .parent()+ .unwrap()+ .join(format!("{}.clobber-dir-test", repo_name));++ // Create a stale directory at that path (not a worktree)+ std::fs::create_dir_all(&expected_path).unwrap();+ std::fs::write(expected_path.join("stale_file.txt"), "stale content").unwrap();++ // With --clobber, should move the directory to .bak and create the worktree+ snapshot_switch(+ "switch_clobber_removes_stale_dir",+ &repo,+ &["--create", "--clobber", "clobber-dir-test"],+ );++ // Verify the worktree was created+ assert!(expected_path.exists());+ assert!(expected_path.is_dir());++ // Verify the backup was created (SOURCE_DATE_EPOCH=1735776000 -> 2025-01-02 00:00:00 UTC)+ let backup_path = repo.root_path().parent().unwrap().join(format!(+ "{}.clobber-dir-test.bak.20250102-000000",+ repo_name+ ));+ assert!(+ backup_path.exists(),+ "Backup should exist at {:?}",+ backup_path+ );+ assert!(backup_path.is_dir(), "Backup should be a directory");++ // Verify stale content is preserved in backup+ let stale_file = backup_path.join("stale_file.txt");+ assert!(stale_file.exists(), "Stale file should be in backup");+ assert_eq!(+ std::fs::read_to_string(&stale_file).unwrap(),+ "stale content"+ );+}++/// Test --clobber moves stale file to .bak and creates worktree+#[rstest]+fn test_switch_clobber_backs_up_stale_file(repo: TestRepo) {+ // Calculate where the worktree would be created+ let repo_name = repo.root_path().file_name().unwrap().to_str().unwrap();+ let expected_path = repo+ .root_path()+ .parent()+ .unwrap()+ .join(format!("{}.clobber-file-test", repo_name));++ // Create a file (not directory) at that path+ std::fs::write(&expected_path, "stale file content").unwrap();++ // With --clobber, should move the file to .bak and create the worktree+ snapshot_switch(+ "switch_clobber_removes_stale_file",+ &repo,+ &["--create", "--clobber", "clobber-file-test"],+ );++ // Verify the worktree was created (should be a directory now)+ assert!(expected_path.is_dir());++ // Verify the backup was created (SOURCE_DATE_EPOCH=1735776000 -> 2025-01-02 00:00:00 UTC)+ let backup_path = repo.root_path().parent().unwrap().join(format!(+ "{}.clobber-file-test.bak.20250102-000000",+ repo_name+ ));+ assert!(+ backup_path.exists(),+ "Backup should exist at {:?}",+ backup_path+ );+ assert!(backup_path.is_file(), "Backup should be a file");+ assert_eq!(+ std::fs::read_to_string(&backup_path).unwrap(),+ "stale file content"+ );+}++/// Test --clobber errors when backup path already exists+#[rstest]+fn test_switch_clobber_error_backup_exists(repo: TestRepo) {+ // Calculate where the worktree would be created+ let repo_name = repo.root_path().file_name().unwrap().to_str().unwrap();+ let expected_path = repo+ .root_path()+ .parent()+ .unwrap()+ .join(format!("{}.clobber-backup-exists", repo_name));++ // Create a stale directory at the target path+ std::fs::create_dir_all(&expected_path).unwrap();++ // Also create the backup path that would be generated+ // SOURCE_DATE_EPOCH=1735776000 -> 2025-01-02 00:00:00 UTC+ let backup_path = repo.root_path().parent().unwrap().join(format!(+ "{}.clobber-backup-exists.bak.20250102-000000",+ repo_name+ ));+ std::fs::create_dir_all(&backup_path).unwrap();++ // With --clobber, should error because backup path exists+ snapshot_switch(+ "switch_clobber_error_backup_exists",+ &repo,+ &["--create", "--clobber", "clobber-backup-exists"],+ );++ // Both paths should still exist (nothing was moved)+ assert!(expected_path.exists());+ assert!(backup_path.exists());+}++/// Test --clobber handles paths with extensions correctly+#[rstest]+fn test_switch_clobber_path_with_extension(repo: TestRepo) {+ // Calculate where the worktree would be created+ let repo_name = repo.root_path().file_name().unwrap().to_str().unwrap();+ let expected_path = repo+ .root_path()+ .parent()+ .unwrap()+ .join(format!("{}.clobber-ext.txt", repo_name));++ // Create a file with an extension at that path+ std::fs::write(&expected_path, "file with extension").unwrap();++ // With --clobber, should move the file preserving extension in backup name+ snapshot_switch(+ "switch_clobber_path_with_extension",+ &repo,+ &["--create", "--clobber", "clobber-ext.txt"],+ );++ // Verify the worktree was created+ assert!(expected_path.is_dir());++ // Verify backup path includes the original extension+ // file.txt -> file.txt.bak.TIMESTAMP+ let backup_path = repo+ .root_path()+ .parent()+ .unwrap()+ .join(format!("{}.clobber-ext.txt.bak.20250102-000000", repo_name));+ assert!(+ backup_path.exists(),+ "Backup should exist at {:?}",+ backup_path+ );+ assert_eq!(+ std::fs::read_to_string(&backup_path).unwrap(),+ "file with extension"+ );+}diff --git a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap b/tests/snapshots/integration__integration_tests__help__help_page_switch.snapindex 1fa134d85..654cfd96d 100644--- a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap+++ b/tests/snapshots/integration__integration_tests__help__help_page_switch.snap@@ -112,6 +112,9 @@ Options:-f, --forceSkip approval prompts+ --clobber+ Remove stale paths at target+--no-verifySkip hooksdiff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snapindex 273acdb48..ec0d318b9 100644--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap@@ -9,7 +9,6 @@ info:CLICOLOR_FORCE: "1"COLUMNS: "150"GIT_EDITOR: ""- GIT_FETCH_ARGS: ""SOURCE_DATE_EPOCH: "1735776000"WORKTRUNK_CONFIG_PATH: /nonexistent/test/config.toml---@@ -52,6 +51,9 @@ Usage: [1m[36mwt switch[0m [36m[OPTIONS][0m [36m<BRANCH>[1m[36m-f[0m, [1m[36m--forceSkip approval prompts+ [1m[36m--clobber+ Remove stale paths at target+[1m[36m--no-verifySkip hooksdiff --git a/tests/snapshots/integration__integration_tests__help__help_switch_short.snap b/tests/snapshots/integration__integration_tests__help__help_switch_short.snapindex e44e39903..9c636863f 100644--- a/tests/snapshots/integration__integration_tests__help__help_switch_short.snap+++ b/tests/snapshots/integration__integration_tests__help__help_switch_short.snap@@ -29,6 +29,7 @@ Usage: [1m[36mwt switch[0m [36m[OPTIONS][0m [36m<BRANCH>[1m[36m-b[0m, [1m[36m--base[0m[36m [0m[36m<BASE>[0m Base branch[1m[36m-x[0m, [1m[36m--execute[0m[36m [0m[36m<EXECUTE>[0m Command to run after switch[1m[36m-f[0m, [1m[36m--force[0m Skip approval prompts+ [1m[36m--clobber[0m Remove stale paths at target[1m[36m--no-verify[0m Skip hooks[1m[36m-h[0m, [1m[36m--help[0m Print help (see more with '--help')diff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_error_backup_exists.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_error_backup_exists.snapnew file mode 100644index 000000000..076c8cdd4--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_error_backup_exists.snap@@ -0,0 +1,34 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--create"+ - "--clobber"+ - clobber-backup-exists+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ PATH: "[PATH]"+ SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: false+exit_code: 1+----- stdout -----++----- stderr -----+❌ [31mBackup path already exists: [REPO].clobber-backup-exists.bak.20250102-000000[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snapnew file mode 100644index 000000000..2863da85f--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_path_with_extension.snap@@ -0,0 +1,36 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--create"+ - "--clobber"+ - clobber-ext.txt+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ PATH: "[PATH]"+ SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+🟡 [33mMoving [1m[REPO].clobber-ext.txt[22m to [1m[REPO].clobber-ext.txt.bak.20250102-000000[22m ([90m--clobber[39m)[39m+✅ [32m[32mCreated new worktree for [1mclobber-ext.txt[22m from [1mmain[22m @ [1m[REPO].clobber-ext.txt[39m[22m[39m+💡 [2mRun [90mwt config shell install[39m to enable automatic cd[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snapnew file mode 100644index 000000000..0e3f9b1de--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_dir.snap@@ -0,0 +1,36 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--create"+ - "--clobber"+ - clobber-dir-test+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ PATH: "[PATH]"+ SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+🟡 [33mMoving [1m[REPO].clobber-dir-test[22m to [1m[REPO].clobber-dir-test.bak.20250102-000000[22m ([90m--clobber[39m)[39m+✅ [32m[32mCreated new worktree for [1mclobber-dir-test[22m from [1mmain[22m @ [1m[REPO].clobber-dir-test[39m[22m[39m+💡 [2mRun [90mwt config shell install[39m to enable automatic cd[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snapnew file mode 100644index 000000000..06a823f53--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_clobber_removes_stale_file.snap@@ -0,0 +1,36 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--create"+ - "--clobber"+ - clobber-file-test+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "150"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ PATH: "[PATH]"+ SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+🟡 [33mMoving [1m[REPO].clobber-file-test[22m to [1m[REPO].clobber-file-test.bak.20250102-000000[22m ([90m--clobber[39m)[39m+✅ [32m[32mCreated new worktree for [1mclobber-file-test[22m from [1mmain[22m @ [1m[REPO].clobber-file-test[39m[22m[39m+💡 [2mRun [90mwt config shell install[39m to enable automatic cd[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snapindex 242eae4ca..751e79889 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap@@ -1,6 +1,5 @@---source: tests/integration_tests/switch.rs-assertion_line: 48info:program: wtargs:@@ -8,6 +7,7 @@ info:- "--create"- occupied-branchenv:+ APPDATA: "[TEST_CONFIG_HOME]"CLICOLOR_FORCE: "1"COLUMNS: "150"GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"@@ -15,11 +15,15 @@ info:GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"GIT_CONFIG_SYSTEM: /dev/nullGIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"HOME: "[TEST_HOME]"LANG: CLC_ALL: C+ PATH: "[PATH]"SOURCE_DATE_EPOCH: "1735776000"+ USERPROFILE: "[TEST_HOME]"WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"---success: falseexit_code: 1@@ -28,4 +32,4 @@ exit_code: 1----- stderr -----❌ [31mDirectory already exists: [1m[REPO].occupied-branch[22m[39m-💡 [2mRemove with [90mrm -rf [REPO].occupied-branch[39m or use a different branch name[22m+💡 [2mUse [90m--clobber[39m to remove, or [90mrm -rf [REPO].occupied-branch[39m[22m