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.rsindex 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.rsindex 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.rsindex 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.rsindex 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 codeGitError::ChildProcessExited { code: _, message } => {- write!(f, "{}", message)+ write!(f, "{ERROR_EMOJI} {ERROR}{message}{ERROR:#}")}// Push faileddiff --git a/src/main.rs b/src/main.rsindex 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.rsindex 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.rsindex 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: falseexit_code: 1----- stdout -----+ β [31mNo 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.[0m----- stderr ------ β [31mNo 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.[0m");});}diff --git a/tests/integration_tests/directives.rs b/tests/integration_tests/directives.rsindex 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: falseexit_code: 1----- stdout ------- ----- stderr -----β [31mFailed to create worktree for [1m[31mmy-feature[0m[0m[40m [0m fatal: invalid reference: my-feature+++ ----- stderr -----");});}@@ -56,11 +57,12 @@ fn test_switch_without_internal() {success: falseexit_code: 1----- stdout ------- ----- stderr -----β [31mFailed to create worktree for [1m[31mmy-feature[0m[0m[40m [0m fatal: invalid reference: my-feature+++ ----- stderr -----");});}diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rsindex 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: falseexit_code: 1----- stdout ------- ----- stderr -----β [31mWorking tree has uncommitted changes[0mπ‘ [2mCommit or stash them first[0m++ ----- 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.snapindex 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()[40m [0m [1m[34mecho[0m [32m'β Test suite failed: 3 tests failing'[0m [36m&&[0m [1m[34mexit[0m 1[0mβ Test suite failed: 3 tests failing-β [31mpre-merge command failed: [1m[31mtest[0m[0m--Command failed with exit code: exit status: 1+β [31mpre-merge command failed: [1m[31mtest[0m: exit status: 1[0mπ‘ [2mUse --no-verify to skip pre-merge commands[0mdiff --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.snapindex 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-β [31mpre-merge command failed: [1m[31mtest[0m[0m--Command failed with exit code: exit status: 1--π‘ [2mUse --no-verify to skip pre-merge commands[0mπ [36mRunning pre-merge [1mformat[0m:[0m[40m [0m [1m[34mecho[0m [32m'β Code formatting check passed'[0m[0mπ [36mRunning pre-merge [1mtest[0m:[0m[40m [0m [1m[34mecho[0m [32m'β Test suite failed: 3 tests failing'[0m [36m&&[0m [1m[34mexit[0m 1[0m++β [31mpre-merge command failed: [1m[31mtest[0m: exit status: 1[0m++π‘ [2mUse --no-verify to skip pre-merge commands[0mdiff --git a/tests/snapshots/integration__integration_tests__approvals__ask_approvals_no_config.snap b/tests/snapshots/integration__integration_tests__approvals__ask_approvals_no_config.snapindex 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: 12info:program: wtargs:@@ -13,17 +12,16 @@ info:GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/nullGIT_CONFIG_SYSTEM: /dev/null- GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----+No project configuration found----- stderr -----β [31mNo project configuration found[0mπ‘ [2mCreate a config file at: [1m[2m[REPO]/.config/wt.toml[0m[0m-No project configuration founddiff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_detached_head.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mNot on a branch (detached HEAD)[0mπ‘ [2mYou are in detached HEAD state[0m++----- 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.snapindex 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/nullGIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_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 -----π [36mMerging 1 commit to [1m[36mmain[0m[36m @ [2m[SHA][0m (no commit/squash/rebase needed)@@ -31,7 +32,10 @@ exit_code: 0β [32mRemoved worktree & branch for [1m[32mfeature[0m[32m, returned to primary at [1m[32m[REPO][0m[0mπ [36mRunning post-merge:[0m[40m [0m [1m[34mexit[0m 1[0m-π‘ [33mCommand failed: Command failed with exit code: exit status: 1[0m+π‘ [33mCommand failed: exit status: 1[0m+β [31mpost-merge command failed: exit status: 1[0m++π‘ [2mUse --no-verify to skip post-merge commands[0m----- stderr -----[0mdiff --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.snapindex 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/nullGIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_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: falseexit_code: 1@@ -25,10 +26,9 @@ exit_code: 1[40m [0m feature.txtπ [36mRunning pre-commit:[0m[40m [0m [1m[34mexit[0m 1[0m------- stderr ------[0mβ [31mpre-commit command failed[0m--Command failed with exit code: exit status: 1+β [31mpre-commit command failed: exit status: 1[0mπ‘ [2mUse --no-verify to skip pre-commit commands[0m++----- stderr -----+[0mdiff --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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----π [36mRunning pre-merge:[0m[40m [0m [1m[34mexit[0m 1[0m------- stderr ------[0mβ [31mpre-merge command failed[0m--Command failed with exit code: exit status: 1+β [31mpre-merge command failed: exit status: 1[0mπ‘ [2mUse --no-verify to skip pre-merge commands[0m++----- stderr -----+[0mdiff --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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----π [36mRunning pre-commit:[0m[40m [0m [1m[34mexit[0m 1[0m------- stderr ------[0mβ [31mpre-commit command failed[0m--Command failed with exit code: exit status: 1+β [31mpre-commit command failed: exit status: 1[0mπ‘ [2mUse --no-verify to skip pre-commit commands[0m++----- stderr -----+[0mdiff --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.snapindex 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: 11info:program: wtargs:@@ -13,10 +12,11 @@ info:GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/nullGIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_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: falseexit_code: 1@@ -30,11 +30,12 @@ exit_code: 1[40m [0m 1 file changed, 1 insertion(+)β [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)π [36mSwitching to [1m[36mmain[0m[36m...[0m------- stderr -----β [31mFailed to switch to [1m[31mmain[0m[0m[40m [0m error: Your local changes to the following files would be overwritten by checkout:[40m [0m file.txt[40m [0m Please commit your changes or stash them before you switch branches.[40m [0m 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----π [36mRebasing onto [1m[36mmain[0m[36m...[0m------- stderr -----β [31mRebase onto [1m[31mmain[0m[31m incomplete[0m[40m [0m Rebasing (1/1)[40m [0m error: could not apply [SHA]... Update shared.txt in feature@@ -33,3 +31,6 @@ exit_code: 1[40m [0m hint: To abort and get back to the state before "git rebase", run "git rebase --abort".[40m [0m hint: Disable this message with "git config set advice.mergeConflict false"[40m [0m 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mFailed to load project config[0m[40m [0m Failed to parse TOML: TOML parse error at line 1, column 39@@ -31,3 +29,6 @@ exit_code: 1[40m [0m 1 | post-create-command = [invalid syntax[40m [0m | ^[40m [0m 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.snapindex 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: CLC_ALL: CSOURCE_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: trueexit_code: 0----- stdout -----π [36mRunning post-create:[0m[40m [0m [1m[34mexit[0m 1[0m-π‘ [33mCommand failed: Command failed with exit code: exit status: 1[0m+π‘ [33mCommand failed: exit status: 1[0mβ [32mCreated new worktree for [1m[32mfeature[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].feature[0m[0mπ‘ [2mTo enable automatic cd, run: wt config shell[0mdiff --git a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snapindex 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: 13info:program: wtargs:@@ -14,18 +13,19 @@ info:GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/nullGIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mCannot push: conflicting uncommitted changes in:[0m[40m [0m conflict.txtπ‘ [2mCommit or stash these changes in [REPO] first[0m++----- 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mCan't push to local [1m[31mmain[0m branch: it has newer commits[0m* [SHA][33m ([m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m, [m[1;32mmain[m[33m)[m Main commitmain-file.txt | 1 [32m+[m1 file changed, 1 insertion(+)π‘ [2mUse 'wt merge' to rebase your changes onto main[0m++----- 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mFound merge commits in push range[0mπ‘ [2mUse --allow-merge-commits to push non-linear history[0m++----- 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----π [36mRemoving worktree for [1m[36mfeature-dirty[0m...[0m------- stderr -----β [31mWorking tree has uncommitted changes[0mπ‘ [2mCommit or stash them first[0m++----- 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----π [36mRemoving worktree...[0m------- stderr -----β [31mWorking tree has uncommitted changes[0mπ‘ [2mCommit or stash them first[0m++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap b/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----π [36mRemoving worktree for [1m[36mnonexistent[0m...[0m+β [31mNo worktree found for branch [1m[31mnonexistent[0m[0m----- stderr ------β [31mNo worktree found for branch [1m[31mnonexistent[0m[0mdiff --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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mBranch [1m[31m__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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mFailed to create worktree for [1m[31m__WORKTRUNK_EXEC__echo PWNED > /tmp/hacked6[0m[0m[40m [0m 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mBranch [1m[31mfeature-y[0m[31m already exists[0mπ‘ [2mRemove --create flag to switch to it[0m++----- 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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout ------------ stderr -----β [31mWorktree directory missing for [1m[31mmissing-wt[0m[0mπ‘ [2mRun 'git worktree prune' to clean up[0m++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_failure.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1@@ -27,6 +27,6 @@ exit_code: 1β [32mCreated new worktree for [1m[32mfail-test[0m[32m from [1m[32mmain[0m[32m at [1m[32m[REPO].fail-test[0m[0mπ [36mExecuting (--execute):[0m[40m [0m [1m[34mexit[0m 1[0m+β [31mexit status: 1[0m----- stderr ------Command failed with exit code: exit status: 1diff --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.snapindex 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: CLC_ALL: CSOURCE_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: falseexit_code: 1----- stdout -----+β [31mNo previous branch found in history. Use 'wt list' to see available worktrees.[0m----- stderr ------β [31mNo previous branch found in history. Use 'wt list' to see available worktrees.[0m