Skip to content

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

fix: Propagate exit codes for PostMerge hook failures

Maximilian Roos753895e96417
diff --git a/src/commands/hooks.rs b/src/commands/hooks.rs
index 94d641680..6c36372ea 100644
--- a/src/commands/hooks.rs
+++ b/src/commands/hooks.rs
@@ -9,9 +9,10 @@ use crate::output::execute_command_in_worktree;
/// Controls how hook execution should respond to failures.
pub enum HookFailureStrategy {
- /// Stop on first failure and surface a `HookCommandFailed` error with the provided hook type.
- FailFast { hook_type: HookType },
+ /// Stop on first failure and surface a `HookCommandFailed` error.
+ FailFast,
/// Log warnings and continue executing remaining commands.
+ /// For PostMerge hooks, propagates exit code after all commands complete.
Warn,
}
@@ -36,6 +37,7 @@ impl<'a> HookPipeline<'a> {
}
/// Run hook commands sequentially, using the provided failure strategy.
+ #[allow(clippy::too_many_arguments)]
pub fn run_sequential(
&self,
command_config: &CommandConfig,
@@ -43,6 +45,7 @@ impl<'a> HookPipeline<'a> {
auto_trust: bool,
extra_vars: &[(&str, &str)],
label_prefix: &str,
+ hook_type: HookType,
failure_strategy: HookFailureStrategy,
) -> Result<(), GitError> {
let commands = self.prepare_commands(command_config, phase, auto_trust, extra_vars)?;
@@ -50,6 +53,9 @@ impl<'a> HookPipeline<'a> {
return Ok(());
}
+ // Track first failure for Warn strategy (to propagate exit code after all commands run)
+ let mut first_failure: Option<(String, Option<String>, i32)> = None;
+
for prepared in commands {
let label =
crate::commands::format_command_label(label_prefix, prepared.name.as_deref());
@@ -59,15 +65,20 @@ impl<'a> HookPipeline<'a> {
if let Err(err) =
execute_command_in_worktree(self.ctx.worktree_path, &prepared.expanded)
{
- let err_msg = err.to_string();
+ // Extract raw message for embedding (without formatting from Display impl)
+ let err_msg = match &err {
+ GitError::ChildProcessExited { message, .. } => message.clone(),
+ other => other.to_string(),
+ };
+ let exit_code = match &err {
+ GitError::ChildProcessExited { code, .. } => Some(*code),
+ _ => None,
+ };
+
match &failure_strategy {
- HookFailureStrategy::FailFast { hook_type } => {
- let exit_code = match &err {
- GitError::ChildProcessExited { code, .. } => Some(*code),
- _ => None,
- };
+ HookFailureStrategy::FailFast => {
return Err(GitError::HookCommandFailed {
- hook_type: *hook_type,
+ hook_type,
command_name: prepared.name.clone(),
error: err_msg,
exit_code,
@@ -81,12 +92,30 @@ impl<'a> HookPipeline<'a> {
None => format!("{WARNING}Command failed: {err_msg}{WARNING:#}"),
};
crate::output::warning(message)?;
+
+ // Track first failure to propagate exit code later (only for PostMerge)
+ if first_failure.is_none() && hook_type == HookType::PostMerge {
+ first_failure =
+ Some((err_msg, prepared.name.clone(), exit_code.unwrap_or(1)));
+ }
}
}
}
}
crate::output::flush()?;
+
+ // For Warn strategy with PostMerge: if any command failed, propagate the exit code
+ // This matches git's behavior: post-hooks can't stop the operation but affect exit status
+ if let Some((error, command_name, exit_code)) = first_failure {
+ return Err(GitError::HookCommandFailed {
+ hook_type,
+ command_name,
+ error,
+ exit_code: Some(exit_code),
+ });
+ }
+
Ok(())
}
@@ -148,9 +177,8 @@ impl<'a> HookPipeline<'a> {
auto_trust,
&extra_vars,
"pre-commit",
- HookFailureStrategy::FailFast {
- hook_type: HookType::PreCommit,
- },
+ HookType::PreCommit,
+ HookFailureStrategy::FailFast,
)
}
}
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 0025c25e1..02ac901b2 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -275,9 +275,8 @@ pub fn run_pre_merge_commands(
true, // auto_trust: commands already approved in batch
&[("target", target_branch)],
"pre-merge",
- HookFailureStrategy::FailFast {
- hook_type: HookType::PreMerge,
- },
+ HookType::PreMerge,
+ HookFailureStrategy::FailFast,
)
}
@@ -304,6 +303,7 @@ pub fn execute_post_merge_commands(
true, // auto_trust: commands already approved in batch
&[("target", target_branch)],
"post-merge",
+ HookType::PostMerge,
HookFailureStrategy::Warn,
)
}
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index eb10aecc3..7ce475ea7 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -99,6 +99,7 @@
//! The shell wrapper is generated by `wt init <shell>` from templates in `templates/`.
use std::path::PathBuf;
+use worktrunk::HookType;
use worktrunk::config::{CommandPhase, WorktrunkConfig};
use worktrunk::git::{GitError, GitResultExt, Repository};
use worktrunk::styling::{CYAN, CYAN_BOLD, GREEN, GREEN_BOLD, WARNING, format_with_gutter};
@@ -394,6 +395,7 @@ impl<'a> CommandContext<'a> {
false,
&[],
"post-create",
+ HookType::PostCreate,
HookFailureStrategy::Warn,
)
}
@@ -437,6 +439,7 @@ impl<'a> CommandContext<'a> {
false,
&[],
"post-start",
+ HookType::PostStart,
HookFailureStrategy::Warn,
)
}
diff --git a/src/git/error.rs b/src/git/error.rs
index 423e7c23d..37d671b35 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -131,7 +131,7 @@ impl std::fmt::Display for GitError {
write!(
f,
- "{ERROR_EMOJI} {ERROR}{hook_type} command failed{name_suffix}{ERROR:#}\n\n{error}\n\n{HINT_EMOJI} {HINT}Use --no-verify to skip {hook_type} commands{HINT:#}"
+ "{ERROR_EMOJI} {ERROR}{hook_type} command failed{name_suffix}: {error}{ERROR:#}\n\n{HINT_EMOJI} {HINT}Use --no-verify to skip {hook_type} commands{HINT:#}"
)
}
@@ -232,9 +232,9 @@ impl std::fmt::Display for GitError {
}
// Child process exited with non-zero code
- // Just display the message - main.rs will use the exit code
+ // Display with error emoji - main.rs will use the exit code
GitError::ChildProcessExited { code: _, message } => {
- write!(f, "{}", message)
+ write!(f, "{ERROR_EMOJI} {ERROR}{message}{ERROR:#}")
}
// Push failed
diff --git a/src/main.rs b/src/main.rs
index 9810172e8..be799e65b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -314,7 +314,8 @@ fn main() {
if let Err(e) = result {
// Error messages are already formatted with emoji and colors
- eprintln!("{}", e);
+ // Per CLAUDE.md: worktrunk output (including errors) goes to stdout
+ println!("{}", e);
// Preserve exit code from child processes (especially for signals like SIGINT)
let exit_code = match &e {
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 4d84f7166..b0900a460 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -252,8 +252,8 @@ pub(crate) fn execute_streaming(
// Get the exit code if available (None means terminated by signal on some platforms)
let code = status.code().unwrap_or(1);
return Err(io::Error::other(format!(
- "CHILD_EXIT_CODE:{} Command failed with exit code: {}",
- code, status
+ "CHILD_EXIT_CODE:{} exit status: {}",
+ code, code
)));
}
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index eba4ede33..1fd07c387 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -213,9 +213,9 @@ fn test_configure_shell_no_files() {
success: false
exit_code: 1
----- stdout -----
+ ❌ No shell config files found in $HOME. Checked: [TEMP_HOME]/.bash_profile, [TEMP_HOME]/.zshrc, and more. Create a config file or use --shell to specify a shell.
----- stderr -----
- ❌ No shell config files found in $HOME. Checked: [TEMP_HOME]/.bash_profile, [TEMP_HOME]/.zshrc, and more. Create a config file or use --shell to specify a shell.
");
});
}
diff --git a/tests/integration_tests/directives.rs b/tests/integration_tests/directives.rs
index dfb616a00..9705a08a8 100644
--- a/tests/integration_tests/directives.rs
+++ b/tests/integration_tests/directives.rs
@@ -27,11 +27,12 @@ fn test_switch_internal_directive() {
success: false
exit_code: 1
----- stdout -----
-
- ----- stderr -----
❌ Failed to create worktree for my-feature
  fatal: invalid reference: my-feature
+
+
+ ----- stderr -----
");
});
}
@@ -56,11 +57,12 @@ fn test_switch_without_internal() {
success: false
exit_code: 1
----- stdout -----
-
- ----- stderr -----
❌ Failed to create worktree for my-feature
  fatal: invalid reference: my-feature
+
+
+ ----- stderr -----
");
});
}
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index 398dc3497..dd9ca946b 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -2363,11 +2363,11 @@ fn test_merge_no_commit_with_dirty_tree() {
success: false
exit_code: 1
----- stdout -----
-
- ----- stderr -----
❌ Working tree has uncommitted changes
πŸ’‘ Commit or stash them first
+
+ ----- stderr -----
");
});
}
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
index 9a53d6bd7..218fd4dae 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
@@ -11,8 +11,6 @@ expression: output.normalized()
  echo 'βœ— Test suite failed: 3 tests failing' && exit 1
βœ— Test suite failed: 3 tests failing
-❌ pre-merge command failed: test
-
-Command failed with exit code: exit status: 1
+❌ pre-merge command failed: test: exit status: 1
πŸ’‘ Use --no-verify to skip pre-merge commands
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
index 109edb381..93c1a6485 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
@@ -4,14 +4,13 @@ expression: output.normalized()
---
βœ“ Code formatting check passed
βœ— Test suite failed: 3 tests failing
-❌ pre-merge command failed: test
-
-Command failed with exit code: exit status: 1
-
-πŸ’‘ Use --no-verify to skip pre-merge commands
πŸ”„ Running pre-merge format:
  echo 'βœ“ Code formatting check passed'
πŸ”„ Running pre-merge test:
  echo 'βœ— Test suite failed: 3 tests failing' && exit 1
+
+❌ pre-merge command failed: test: exit status: 1
+
+πŸ’‘ Use --no-verify to skip pre-merge commands
diff --git a/tests/snapshots/integration__integration_tests__approvals__ask_approvals_no_config.snap b/tests/snapshots/integration__integration_tests__approvals__ask_approvals_no_config.snap
index ae8902005..753d3ab50 100644
--- a/tests/snapshots/integration__integration_tests__approvals__ask_approvals_no_config.snap
+++ b/tests/snapshots/integration__integration_tests__approvals__ask_approvals_no_config.snap
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/approvals.rs
-assertion_line: 12
info:
program: wt
args:
@@ -13,17 +12,16 @@ 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/.tmpU3OaGe/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp540aeR/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
+No project configuration found
----- stderr -----
❌ No project configuration found
πŸ’‘ Create a config file at: [REPO]/.config/wt.toml
-No project configuration found
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap
index d14ff79cc..820eb69ac 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap
@@ -16,13 +16,13 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpzqJEsX/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpjEj9Jj/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Not on a branch (detached HEAD)
πŸ’‘ You are in detached HEAD state
+
+----- 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 54e517df2..8d7302142 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
@@ -13,13 +13,14 @@ 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/.tmpZUtX6m/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXK9GZq/test-config.toml
---
-success: true
-exit_code: 0
+success: false
+exit_code: 1
----- stdout -----
πŸ”„ Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
@@ -31,7 +32,10 @@ exit_code: 0
βœ… Removed worktree & branch for feature, returned to primary at [REPO]
πŸ”„ Running post-merge:
  exit 1
-🟑 Command failed: Command failed with exit code: exit status: 1
+🟑 Command failed: exit status: 1
+❌ post-merge command failed: exit status: 1
+
+πŸ’‘ Use --no-verify to skip post-merge commands
----- stderr -----

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_failure.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_failure.snap
index c99eacb17..2bb09dc31 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_failure.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_failure.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/.tmpXveIlz/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpmeAOIz/test-config.toml
---
success: false
exit_code: 1
@@ -25,10 +26,9 @@ exit_code: 1
  feature.txt
πŸ”„ Running pre-commit:
  exit 1
-
------ stderr -----
-❌ pre-commit command failed
-
-Command failed with exit code: exit status: 1
+❌ pre-commit command failed: exit status: 1
πŸ’‘ Use --no-verify to skip pre-commit commands
+
+----- stderr -----
+
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_failure.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_failure.snap
index 580f9c27f..d2359bffa 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_failure.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_failure.snap
@@ -17,17 +17,16 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpr40W7R/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp6EkpPt/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
πŸ”„ Running pre-merge:
  exit 1
-
------ stderr -----
-❌ pre-merge command failed
-
-Command failed with exit code: exit status: 1
+❌ pre-merge command failed: exit status: 1
πŸ’‘ Use --no-verify to skip pre-merge commands
+
+----- stderr -----
+
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_failure.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_failure.snap
index f40eb108f..336ed8c14 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_failure.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_failure.snap
@@ -17,17 +17,16 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpR5e9eu/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDWBRfs/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
πŸ”„ Running pre-commit:
  exit 1
-
------ stderr -----
-❌ pre-commit command failed
-
-Command failed with exit code: exit status: 1
+❌ pre-commit command failed: exit status: 1
πŸ’‘ Use --no-verify to skip pre-commit commands
+
+----- 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 ef95fb38e..c825227ea 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
@@ -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/.tmpEnmt5J/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpiUrIVl/test-config.toml
---
success: false
exit_code: 1
@@ -30,11 +30,12 @@ exit_code: 1
  1 file changed, 1 insertion(+)
βœ… Merged to main (1 commit, 1 file, +1)
πŸ”„ Switching to main...
-
------ stderr -----
❌ 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
+
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap
index 5ea447d62..dab8dd60b 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap
@@ -16,14 +16,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpPrhTGw/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpVF2rIO/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
πŸ”„ Rebasing onto main...
-
------ stderr -----
❌ Rebase onto main incomplete
  Rebasing (1/1)
  error: could not apply [SHA]... Update shared.txt in feature
@@ -33,3 +31,6 @@ exit_code: 1
  hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
  hint: Disable this message with "git config set advice.mergeConflict false"
  Could not apply [SHA]... # Update shared.txt in feature
+
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__invalid_toml.snap b/tests/snapshots/integration__integration_tests__post_start_commands__invalid_toml.snap
index a481bcdee..65c20b6b3 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__invalid_toml.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__invalid_toml.snap
@@ -17,13 +17,11 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpaewYd9/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmprBFTsP/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Failed to load project config
  Failed to parse TOML: TOML parse error at line 1, column 39
@@ -31,3 +29,6 @@ exit_code: 1
  1 | post-create-command = [invalid syntax
  | ^
  unclosed array, expected `]`
+
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
index 5cae3a3fe..3a73c9088 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_failing_command.snap
@@ -17,14 +17,14 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDUcUbD/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpzwr3Mq/test-config.toml
---
success: true
exit_code: 0
----- stdout -----
πŸ”„ Running post-create:
  exit 1
-🟑 Command failed: Command failed with exit code: exit status: 1
+🟑 Command failed: exit status: 1
βœ… Created new worktree for feature from main at [REPO].feature
πŸ’‘ To enable automatic cd, run: wt config shell
diff --git a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap
index 6a1214d71..63987a086 100644
--- a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap
@@ -1,6 +1,5 @@
---
source: tests/integration_tests/push.rs
-assertion_line: 13
info:
program: wt
args:
@@ -14,18 +13,19 @@ 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/.tmpLjwqDc/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp4HfSRW/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Cannot push: conflicting uncommitted changes in:
  conflict.txt
πŸ’‘ Commit or stash these changes in [REPO] first
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap
index 8cdcbcba4..93006b638 100644
--- a/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_error_not_fast_forward.snap
@@ -17,16 +17,16 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDCJJm2/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpW8hg8S/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Can't push to local main branch: it has newer commits
* [SHA] (origin/main, origin/HEAD, main) Main commit
main-file.txt | 1 +
1 file changed, 1 insertion(+)
πŸ’‘ Use 'wt merge' to rebase your changes onto main
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap b/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap
index 0e303b680..f4923d240 100644
--- a/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_error_with_merge_commits.snap
@@ -17,13 +17,13 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpSjJ2Qr/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpQeCSMi/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Found merge commits in push range
πŸ’‘ Use --allow-merge-commits to push non-linear history
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_by_name_dirty_target.snap b/tests/snapshots/integration__integration_tests__remove__remove_by_name_dirty_target.snap
index 1ff35f270..fc124c59e 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_by_name_dirty_target.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_by_name_dirty_target.snap
@@ -16,14 +16,14 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp7eJKXK/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpoL2sq2/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
πŸ”„ Removing worktree for feature-dirty...
-
------ stderr -----
❌ Working tree has uncommitted changes
πŸ’‘ Commit or stash them first
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap
index 7342092e2..8aaf4beab 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_dirty_working_tree.snap
@@ -15,14 +15,14 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpCFMYgl/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpJ04hhT/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
πŸ”„ Removing worktree...
-
------ stderr -----
❌ Working tree has uncommitted changes
πŸ’‘ Commit or stash them first
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap b/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
index 80119ea0a..fea38ed82 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
@@ -16,12 +16,12 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpzi7ZBp/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpD8gbZi/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
πŸ”„ Removing worktree for nonexistent...
+❌ No worktree found for branch nonexistent
----- stderr -----
-❌ No worktree found for branch nonexistent
diff --git a/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap
index 433703c98..3aa08b698 100644
--- a/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap
+++ b/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap
@@ -18,11 +18,9 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpR8clH4/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpr1fhKK/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Branch __WORKTRUNK_CD__[PATH]
diff --git a/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap
index d84eb5a31..ffe17808b 100644
--- a/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap
+++ b/tests/snapshots/integration__integration_tests__security__error_message_with_directive_not_executed.snap
@@ -17,13 +17,14 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpu6bY66/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpJfokz4/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Failed to create worktree for __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6
  fatal: invalid reference: __WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6
+
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap b/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap
index 96480221d..0f90f6cff 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_create_existing_error.snap
@@ -17,13 +17,13 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfkskyY/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpawHIhU/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Branch feature-y already exists
πŸ’‘ Remove --create flag to switch to it
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap
index 7a2e7d019..3faa491b3 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_missing_directory.snap
@@ -16,13 +16,13 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpnDs2OV/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpsdITfr/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
-
------ stderr -----
❌ Worktree directory missing for missing-wt
πŸ’‘ Run 'git worktree prune' to clean up
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
index 4f11e67cc..d7e8ba1a1 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap
@@ -19,7 +19,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpkWhlc7/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpfdolLo/test-config.toml
---
success: false
exit_code: 1
@@ -27,6 +27,6 @@ exit_code: 1
βœ… Created new worktree for fail-test from main at [REPO].fail-test
πŸ”„ Executing (--execute):
  exit 1
+❌ exit status: 1
----- stderr -----
-Command failed with exit code: exit status: 1
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_previous_branch_no_history.snap b/tests/snapshots/integration__integration_tests__switch__switch_previous_branch_no_history.snap
index a85ae45a5..eee5d1b8c 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_previous_branch_no_history.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_previous_branch_no_history.snap
@@ -16,11 +16,11 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpIz3CvP/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpY8QQTV/test-config.toml
---
success: false
exit_code: 1
----- stdout -----
+❌ No previous branch found in history. Use 'wt list' to see available worktrees.
----- stderr -----
-❌ No previous branch found in history. Use 'wt list' to see available worktrees.