Skip to content

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

feat(merge): Refactor worktree cleanup destination

Maximilian Roosdb1ea137ece4
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 874fa8792..9ca58be4c 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -1,7 +1,7 @@
use worktrunk::HookType;
use worktrunk::config::{Command, CommandPhase, ProjectConfig};
use worktrunk::git::{GitError, Repository};
-use worktrunk::styling::{CYAN, CYAN_BOLD, ERROR, ERROR_EMOJI, GREEN_BOLD, HINT, HINT_EMOJI};
+use worktrunk::styling::{CYAN, ERROR, ERROR_EMOJI, GREEN_BOLD, HINT, HINT_EMOJI};
use super::command_approval::approve_command_batch;
use super::command_executor::CommandContext;
@@ -175,39 +175,29 @@ pub fn handle_merge(
let worktrees = repo.list_worktrees()?;
let primary_worktree_dir = worktrees.worktrees[0].path.clone();
+ // Determine destination: target branch's worktree if it exists, otherwise primary worktree
+ let target_worktree_path = repo.worktree_for_branch(&target_branch)?;
+ let destination_path = target_worktree_path
+ .as_ref()
+ .unwrap_or(&primary_worktree_dir)
+ .clone();
+
// Finish worktree unless --no-remove was specified
if !no_remove_effective {
// STEP 1: Check for uncommitted changes before attempting cleanup
// This prevents showing "Cleaning up worktree..." before failing
repo.ensure_clean_working_tree()?;
- // STEP 2: Switch to target branch in primary worktree (fails safely if there's an issue)
- let primary_repo = Repository::at(&primary_worktree_dir);
- let new_branch = primary_repo.current_branch()?;
- if new_branch.as_deref() != Some(&target_branch) {
- crate::output::progress(format!(
- "{CYAN}Switching to {CYAN_BOLD}{target_branch}{CYAN_BOLD:#}{CYAN}...{CYAN:#}"
- ))?;
- if let Err(err) = primary_repo.run_command(&["switch", &target_branch]) {
- return Err(match err {
- GitError::CommandFailed(msg) => GitError::SwitchFailed {
- branch: target_branch.clone(),
- error: msg,
- },
- other => other,
- });
- }
- }
-
- // STEP 3: Remove worktree via shared remove output handler so final message matches wt remove
+ // STEP 2: Remove worktree via shared remove output handler so final message matches wt remove
crate::output::progress(format!("{CYAN}Removing worktree & branch...{CYAN:#}"))?;
let worktree_root = repo.worktree_root()?;
let remove_result = RemoveResult::RemovedWorktree {
- primary_path: primary_worktree_dir.clone(),
+ primary_path: destination_path.clone(),
worktree_path: worktree_root,
changed_directory: true,
branch_name: current_branch.clone(),
no_delete_branch: false,
+ target_branch: Some(target_branch.clone()),
};
crate::output::handle_remove_output(&remove_result, Some(&current_branch), true)?;
} else {
@@ -216,17 +206,17 @@ pub fn handle_merge(
}
if !no_verify {
- // Execute post-merge commands in the main worktree
+ // Execute post-merge commands in the destination worktree
// This runs after cleanup so the context is clear to the user
- // Create a fresh Repository instance at the primary worktree (the old repo may be invalid)
- let primary_repo = Repository::at(&primary_worktree_dir);
- let primary_repo_root = primary_worktree_dir.clone();
+ // Create a fresh Repository instance at the destination (the old repo may be invalid)
+ let destination_repo = Repository::at(&destination_path);
+ let destination_repo_root = destination_path.clone();
let ctx = CommandContext::new(
- &primary_repo,
+ &destination_repo,
config,
&current_branch,
- &primary_worktree_dir,
- &primary_repo_root,
+ &destination_path,
+ &destination_repo_root,
force,
);
execute_post_merge_commands(&ctx, &target_branch, true)?;
diff --git a/src/commands/repository_ext.rs b/src/commands/repository_ext.rs
index c28f828c2..f5f99a177 100644
--- a/src/commands/repository_ext.rs
+++ b/src/commands/repository_ext.rs
@@ -184,6 +184,7 @@ impl RepositoryCliExt for Repository {
changed_directory: true,
branch_name: current_branch,
no_delete_branch,
+ target_branch: None,
});
}
@@ -246,6 +247,7 @@ impl RepositoryCliExt for Repository {
changed_directory,
branch_name: branch_name.to_string(),
no_delete_branch,
+ target_branch: None,
})
}
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 5a9c1330e..1fd6ba269 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -152,6 +152,7 @@ pub enum RemoveResult {
changed_directory: bool,
branch_name: String,
no_delete_branch: bool,
+ target_branch: Option<String>,
},
/// Switched to default branch in main repo
SwitchedToDefault(String),
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 5b5e103dc..432108581 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -69,12 +69,12 @@ fn format_remove_message(
if let Some(b) = branch_display {
// Re-establish GREEN after each green_bold reset to prevent color leak
format!(
- "{GREEN}{action} for {GREEN_BOLD}{b}{GREEN_BOLD:#}{GREEN}, returned to primary at {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",
+ "{GREEN}{action} for {GREEN_BOLD}{b}{GREEN_BOLD:#}{GREEN}, changed directory to {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",
primary_path.display()
)
} else {
format!(
- "{GREEN}{action}, returned to primary at {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",
+ "{GREEN}{action}, changed directory to {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",
primary_path.display()
)
}
@@ -151,6 +151,7 @@ pub fn handle_remove_output(
changed_directory,
branch_name,
no_delete_branch,
+ target_branch,
} = result
{
// 1. Emit cd directive if needed - shell will execute this immediately
@@ -176,13 +177,33 @@ pub fn handle_remove_output(
// 3. Delete the branch (unless --no-delete-branch was specified)
// Returns true if branch was successfully deleted, false otherwise
if !no_delete_branch {
- // Create a Repository instance from the primary path to ensure we're running
- // the command from a valid directory (the worktree we just removed may have
- // been the current directory)
- let primary_repo = worktrunk::git::Repository::at(primary_path);
+ let deletion_repo = worktrunk::git::Repository::at(primary_path);
+
+ // Determine what to check against: target branch if specified, otherwise HEAD
+ let check_target = target_branch.as_deref().unwrap_or("HEAD");
+
+ // Use git merge-base --is-ancestor to check if branch is merged to target
+ // This is the same safety check that `git branch -d` does, but we can specify the target
+ let delete_result = match deletion_repo.run_command(&[
+ "merge-base",
+ "--is-ancestor",
+ branch_name,
+ check_target,
+ ]) {
+ Ok(_) => {
+ // Branch is an ancestor of target (fully merged), safe to delete
+ deletion_repo.run_command(&["branch", "-D", branch_name])
+ }
+ Err(_) => {
+ // Branch is not fully merged to target
+ Err(worktrunk::git::GitError::CommandFailed(format!(
+ "error: the branch '{}' is not fully merged",
+ branch_name
+ )))
+ }
+ };
- // Use safe delete (-d) which fails if branch has unmerged commits
- match primary_repo.run_command(&["branch", "-d", branch_name]) {
+ match delete_result {
Ok(_) => true,
Err(e) => {
if strict_branch_deletion {
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index dd9ca946b..bcf55abf2 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -2503,8 +2503,8 @@ fn test_merge_primary_on_different_branch() {
Some(&feature_wt),
);
- // Verify primary switched to main after merge
- assert_eq!(repo.current_branch(), "main");
+ // Verify primary stayed on develop (we don't switch branches, only worktrees)
+ assert_eq!(repo.current_branch(), "develop");
}
#[test]
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
index 39efe6e18..8bdae401d 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
@@ -29,4 +29,4 @@ expression: output.normalized()
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [TMPDIR]/test-repo
+βœ… Removed worktree & branch for feature, changed directory to [TMPDIR]/test-repo
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
index 39efe6e18..8bdae401d 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
@@ -29,4 +29,4 @@ expression: output.normalized()
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [TMPDIR]/test-repo
+βœ… Removed worktree & branch for feature, changed directory to [TMPDIR]/test-repo
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
index 51f78d8d7..5c1af77ec 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
@@ -18,4 +18,4 @@ expression: output.normalized()
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [TMPDIR]/test-repo
+βœ… Removed worktree & branch for feature, changed directory to [TMPDIR]/test-repo
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
index 51f78d8d7..5c1af77ec 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
@@ -18,4 +18,4 @@ expression: output.normalized()
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [TMPDIR]/test-repo
+βœ… Removed worktree & branch for feature, changed directory to [TMPDIR]/test-repo
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap
index 718600edd..ae7d32dfb 100644
Binary files a/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap and b/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap differ
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
index 5fb73b0a1..c3f09d5ba 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
@@ -18,7 +18,7 @@ info:
SOURCE_DATE_EPOCH: "1761609600"
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update file 1 content"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpSSwp5e/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpvDIUwx/test-config.toml
---
success: true
exit_code: 0
@@ -40,6 +40,6 @@ exit_code: 0
  2 files changed, 2 insertions(+)
βœ… Merged to main (1 commit, 2 files, +2)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
index 0ece4310f..3c0b2421e 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp3XJFhk/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpVw44sM/test-config.toml
---
success: true
exit_code: 0
@@ -36,6 +36,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
index 0c2e71642..55fa001ae 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
@@ -18,7 +18,7 @@ info:
SOURCE_DATE_EPOCH: "1761609600"
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: improve auth validation logic"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpK1SDEB/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpQrDAcA/test-config.toml
---
success: true
exit_code: 0
@@ -38,6 +38,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap
index e25a60158..2ecb7949c 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpOTMGKu/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpNk2Vkx/test-config.toml
---
success: true
exit_code: 0
@@ -34,6 +34,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
index f3bb3b40e..7e258b0c5 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
@@ -12,10 +12,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpBbNoY5/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0QBfBm/test-config.toml
---
success: true
exit_code: 0
@@ -27,6 +28,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
index 5463a3ff3..2fe22f5e2 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
@@ -12,16 +12,17 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0DAZH9/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp6QYAqE/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
βœ… Merged to main (no new commits, no rebase needed)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for no-commits, returned to primary at [REPO]
+βœ… Removed worktree & branch for no-commits, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap
index bb9560b1d..4a9a60e8f 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpaDm0S1/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpMGQMEy/test-config.toml
---
success: true
exit_code: 0
@@ -34,6 +34,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for no-commits-dirty, returned to primary at [REPO]
+βœ… Removed worktree & branch for no-commits-dirty, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
index 1c833387f..d6b8d985c 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
@@ -13,10 +13,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp344tWe/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpvNkMKB/test-config.toml
---
success: true
exit_code: 0
@@ -30,6 +31,6 @@ exit_code: 0
  2 files changed, 2 insertions(+)
βœ… Merged to main (2 commits, 2 files, +2)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
index 2e6c81d61..fcea1b4aa 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
@@ -12,10 +12,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmph5Mekf/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUQMOzG/test-config.toml
---
success: true
exit_code: 0
@@ -27,6 +28,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap
index 8d7302142..890c51c0a 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXK9GZq/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpmjP1io/test-config.toml
---
success: false
exit_code: 1
@@ -29,7 +29,7 @@ exit_code: 1
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
πŸ”„ Running post-merge:
  exit 1
🟑 Command failed: exit status: 1
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
index 8dd9b7308..b8f5a90da 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
@@ -13,10 +13,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpeKuVqu/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcihcnx/test-config.toml
---
success: true
exit_code: 0
@@ -28,7 +29,7 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
πŸ”„ Running post-merge notify:
  echo 'Merge to main complete' > notify.txt
πŸ”„ Running post-merge deploy:
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
index e0e583126..be0a63180 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
@@ -14,10 +14,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUCbYQE/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpbO1jeF/test-config.toml
---
success: true
exit_code: 0
@@ -29,6 +30,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap
index 53c018f84..be5ab3d52 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap
@@ -13,10 +13,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpOgfyYr/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp7FRaV5/test-config.toml
---
success: true
exit_code: 0
@@ -28,7 +29,7 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
πŸ”„ Running post-merge:
  echo 'merged feature to main' > post-merge-ran.txt
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
index 199385541..03cd79851 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpit6B51/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpvtdLhK/test-config.toml
---
success: true
exit_code: 0
@@ -37,7 +37,7 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
Pre-commit check passed
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
index 1081241fd..6b984db04 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
@@ -13,10 +13,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpeSfyqZ/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp6aktDv/test-config.toml
---
success: true
exit_code: 0
@@ -34,7 +35,7 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap
index 3dbd2c600..ebe5eef14 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap
@@ -13,10 +13,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfBUAox/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpoDPmOC/test-config.toml
---
success: true
exit_code: 0
@@ -30,7 +31,7 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
index ec3238030..bd9b260b3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
@@ -13,10 +13,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjSvuWj/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpbRfyYy/test-config.toml
---
success: true
exit_code: 0
@@ -30,7 +31,7 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
Pre-commit check passed
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap
index 96ae44bb8..f76ae399a 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap
@@ -12,10 +12,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp8TCe60/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDt5Nqc/test-config.toml
---
success: true
exit_code: 0
@@ -26,8 +27,7 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
-πŸ”„ Switching to main...
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature-from-develop, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-from-develop, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap
index 1331d6c04..46050d1dc 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap
@@ -16,10 +16,10 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpxaDqD2/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXhTLbu/test-config.toml
---
-success: false
-exit_code: 1
+success: true
+exit_code: 0
----- stdout -----
πŸ”„ Rebasing onto main...
βœ… Rebased onto main
@@ -29,12 +29,7 @@ exit_code: 1
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
-πŸ”„ Switching to main...
-❌ Failed to switch to main
-  error: Your local changes to the following files would be overwritten by checkout:
-  file.txt
-  Please commit your changes or stash them before you switch branches.
-  Aborting
-
+πŸ”„ Removing worktree & branch...
+βœ… Removed worktree & branch for feature-dirty-primary, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
index b8fd16fc7..981defbb1 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpdJuHDk/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmphvQWkH/test-config.toml
---
success: true
exit_code: 0
@@ -40,6 +40,6 @@ exit_code: 0
  3 files changed, 3 insertions(+)
βœ… Merged to main (1 commit, 3 files, +3)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
index 4f36215f2..890f4b324 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpX8vgSy/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0YexFW/test-config.toml
---
success: true
exit_code: 0
@@ -33,6 +33,6 @@ exit_code: 0
βšͺ No changes after squashing 3 commits
βœ… Merged to main (no new commits, no rebase needed)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
index 0c2483e8d..ba4fc4bbe 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
@@ -17,7 +17,7 @@ info:
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
WORKTRUNK_COMMIT_GENERATION__COMMAND: nonexistent-llm-command
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfNAwi9/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjsJ0Qf/test-config.toml
---
success: true
exit_code: 0
@@ -39,6 +39,6 @@ exit_code: 0
  2 files changed, 2 insertions(+)
βœ… Merged to main (1 commit, 2 files, +2)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
index 1c5ef01b2..1477e6158 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
@@ -12,10 +12,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpbGm9rr/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpboIiiA/test-config.toml
---
success: true
exit_code: 0
@@ -27,6 +28,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
index 840def929..bd18eb234 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
@@ -19,7 +19,7 @@ info:
WORKTRUNK_COMMIT_GENERATION__ARGS__0: "-c"
WORKTRUNK_COMMIT_GENERATION__ARGS__1: "cat >/dev/null && echo 'feat: implement user authentication system'"
WORKTRUNK_COMMIT_GENERATION__COMMAND: sh
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp3kKR3W/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpOuLIpW/test-config.toml
---
success: true
exit_code: 0
@@ -40,6 +40,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
index dbc4ee60c..a0513fc64 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
@@ -11,10 +11,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmphLqVJ1/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmphMDEpp/test-config.toml
---
success: true
exit_code: 0
@@ -26,6 +27,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap
index 5af9f2e9c..c00b74364 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap
@@ -12,10 +12,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpnUJRO4/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpsc94Ii/test-config.toml
---
success: true
exit_code: 0
@@ -29,6 +30,6 @@ exit_code: 0
  1 file changed, 1 insertion(+)
βœ… Merged to staging (1 commit, 1 file, +1)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature-for-staging, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-for-staging, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
index 2f7850f13..b01ca0770 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
@@ -18,7 +18,7 @@ info:
SOURCE_DATE_EPOCH: "1761609600"
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: commit changes"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpWPwD37/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp9X1OmC/test-config.toml
---
success: true
exit_code: 0
@@ -43,6 +43,6 @@ exit_code: 0
  3 files changed, 3 insertions(+)
βœ… Merged to main (1 commit, 3 files, +3)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
index 77f74df93..019f4ed83 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/merge.rs
-assertion_line: 29
info:
program: wt
args:
@@ -14,11 +13,12 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
- PATH: "/private/var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcSwkET/test-repo/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+ PATH: "/private/var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXhUJ6w/test-repo/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcSwkET/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXhUJ6w/test-config.toml
---
success: true
exit_code: 0
@@ -48,7 +48,7 @@ exit_code: 0
  3 files changed, 33 insertions(+)
βœ… Merged to main (1 commit, 3 files, +33)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature-auth, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-auth, changed directory to [REPO]
πŸ”„ Running post-merge install:
  cargo install --path .
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
index 071236f88..663f9f181 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
@@ -16,9 +16,9 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- PATH: "/private/var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpp9hkDo/test-repo/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+ PATH: "/private/var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUTUBw4/test-repo/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpp9hkDo/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUTUBw4/test-config.toml
---
success: true
exit_code: 0
@@ -42,7 +42,7 @@ exit_code: 0
  2 files changed, 45 insertions(+)
βœ… Merged to main (1 commit, 2 files, +45)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for feature-auth, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-auth, changed directory to [REPO]
----- stderr -----

diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
index 74cac249c..6efdcacbf 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/merge.rs
-assertion_line: 11
info:
program: wt
args:
@@ -13,10 +12,11 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpl3Y22A/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDqs41s/test-config.toml
---
success: true
exit_code: 0
@@ -28,6 +28,6 @@ exit_code: 0
  1 file changed, 13 insertions(+)
βœ… Merged to main (1 commit, 1 file, +13)
πŸ”„ Removing worktree & branch...
-βœ… Removed worktree & branch for fix-auth, returned to primary at [REPO]
+βœ… Removed worktree & branch for fix-auth, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap b/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
index b20e0700c..0789d6ffa 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpRUqppL/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp7TLzj2/test-config.toml
---
success: true
exit_code: 0
@@ -24,8 +24,6 @@ exit_code: 0
πŸ”„ Removing worktree for feature-unmerged...
🟑 Could not delete branch feature-unmerged
  error: the branch 'feature-unmerged' is not fully merged
-  hint: If you are sure you want to delete it, run 'git branch -D feature-unmerged'
-  hint: Disable this message with "git config set advice.forceDeleteBranch false"
βœ… Removed worktree for feature-unmerged
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_current_by_name.snap b/tests/snapshots/integration__integration_tests__remove__remove_current_by_name.snap
index b4de8fc27..3adbadb53 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_current_by_name.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_current_by_name.snap
@@ -16,12 +16,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpYF72Ax/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpeD1SRN/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
πŸ”„ Removing worktree for feature-current...
-βœ… Removed worktree & branch for feature-current, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-current, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap b/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap
index 1a365ce87..3515ca320 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_from_worktree.snap
@@ -15,12 +15,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpd0RKVq/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpOZr488/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
πŸ”„ Removing worktree...
-βœ… Removed worktree & branch for feature-wt, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-wt, changed directory to [REPO]
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap
index 59cdaff9b..8da5ff120 100644
Binary files a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap and b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_multiple_including_current.snap b/tests/snapshots/integration__integration_tests__remove__remove_multiple_including_current.snap
index 0c05620bf..ef432897b 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_multiple_including_current.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_multiple_including_current.snap
@@ -18,7 +18,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpC6kt31/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpB8muTV/test-config.toml
---
success: true
exit_code: 0
@@ -28,6 +28,6 @@ exit_code: 0
πŸ”„ Removing worktree for feature-c...
βœ… Removed worktree & branch for feature-c
πŸ”„ Removing worktree for feature-a...
-βœ… Removed worktree & branch for feature-a, returned to primary at [REPO]
+βœ… Removed worktree & branch for feature-a, changed directory to [REPO]
----- stderr -----