Skip to content

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

Improve error messages and consistency

Maximilian Roos4bdf4e1f92f6
diff --git a/CLAUDE.md b/CLAUDE.md
index 35fd7d486..b8ca8b91f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -199,8 +199,8 @@ Six canonical message patterns with their emojis:
### stdout vs stderr: Separation by Mode
**Interactive mode:**
-- stdout: All worktrunk output (messages, errors, warnings, progress)
-- stderr: Child process output (git, npm, user commands) + interactive prompts
+- stdout: Status messages (progress, success, warning, info, hint)
+- stderr: Errors, gutter content (diagnostics), child process output, interactive prompts
**Directive mode** (--internal flag for shell integration):
- stdout: Shell script emitted at the end (e.g., `cd '/path/to/worktree'`)
@@ -370,24 +370,35 @@ output::gutter(format_with_gutter(&log, "", None))?;
output::progress(format!("{CYAN}Merging...{CYAN:#}\n"))?;
```
-### External Command Error Formatting
+### Error Message Formatting
-When external commands (user-configured commands like LLM tools, hooks) fail, error messages must:
+**Single-line errors with variables are fine:**
+```rust
+// ✅ GOOD - single-line with path variable
+.map_err(|e| format!("Failed to read {}: {}", format_path_for_display(path), e))?
+
+// ✅ GOOD - using .context() for simple errors
+std::fs::read_to_string(&path).context("Failed to read config")?
+```
+
+**Multi-line external output needs gutter formatting:**
+
+When external commands (git, npm, LLM tools, hooks) produce multi-line stderr, use gutter formatting:
1. **Show the command that was run** - Include the full command with arguments so users can debug
-2. **Put error output in a gutter** - Don't embed raw stderr inline in the message
+2. **Put multi-line output in a gutter** - Don't embed raw stderr inline in the message
Use the `format_error_block` helper in `src/git/error.rs` or follow its pattern:
```rust
-// ✅ GOOD - command shown in header, error in gutter
+// ✅ GOOD - command shown in header, multi-line error in gutter
❌ Commit generation command 'llm --model claude' failed
┃ Error: [Errno 8] nodename nor servname provided, or not known
-// ❌ BAD - error embedded inline, command not shown
+// ❌ BAD - multi-line error embedded inline
❌ Commit generation command 'llm' failed: LLM command failed: Error: [Errno 8]...
```
-**Implementation:** See `format_error_block()` in `src/git/error.rs` for the pattern, and `llm_command_failed()` for an example.
+**Implementation:** See `format_error_block()` in `src/git/error.rs` for the pattern, and `LlmCommandFailed` variant for an example.
### Table Column Alignment
diff --git a/README.md b/README.md
index 2ddcb8760..37762f532 100644
--- a/README.md
+++ b/README.md
@@ -165,8 +165,20 @@ $ wt merge
✅ Squashed @ a1b2c3d
🔄 Running pre-merge test:
cargo test
+ Finished test [unoptimized + debuginfo] target(s) in 0.12s
+ Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)
+
+running 18 tests
+test auth::tests::test_jwt_decode ... ok
+test auth::tests::test_jwt_encode ... ok
+test auth::tests::test_token_refresh ... ok
+test auth::tests::test_token_validation ... ok
+
+test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
🔄 Running pre-merge lint:
cargo clippy
+ Checking worktrunk v0.1.0
+ Finished dev [unoptimized + debuginfo] target(s) in 1.23s
🔄 Merging 1 commit to main @ a1b2c3d (no rebase needed)
* a1b2c3d feat(auth): Implement JWT authentication system
auth.rs | 8 ++++++++
@@ -177,6 +189,11 @@ $ wt merge
🔄 Removing feature-auth worktree & branch in background
🔄 Running post-merge install:
cargo install --path .
+ Installing worktrunk v0.1.0
+ Compiling worktrunk v0.1.0
+ Finished release [optimized] target(s) in 2.34s
+ Installing ~/.cargo/bin/wt
+ Installed package `worktrunk v0.1.0` (executable `wt`)
```
<!-- END AUTO-GENERATED -->
diff --git a/src/commands/command_approval.rs b/src/commands/command_approval.rs
index 0ae6938d0..c9daa4f78 100644
--- a/src/commands/command_approval.rs
+++ b/src/commands/command_approval.rs
@@ -109,7 +109,7 @@ fn prompt_for_batch_approval(commands: &[&Command], project_id: &str) -> anyhow:
// This happens AFTER showing the commands so they appear in CI/CD logs
// even when the prompt cannot be displayed (fail-fast principle)
if !io::stdin().is_terminal() {
- return Err(GitError::NotInteractive.styled_err());
+ return Err(GitError::NotInteractive.into());
}
// Flush stderr before showing prompt to ensure all output is visible
diff --git a/src/commands/config.rs b/src/commands/config.rs
index ec9a41c12..851d47ce8 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -44,8 +44,11 @@ fn comment_out_config(content: &str) -> String {
/// Handle the config create command
pub fn handle_config_create() -> anyhow::Result<()> {
- let config_path = get_global_config_path()
- .ok_or_else(|| anyhow::anyhow!("Could not determine global config path"))?;
+ let config_path = get_global_config_path().ok_or_else(|| {
+ anyhow::anyhow!(
+ "Cannot determine config directory. Set $HOME or $XDG_CONFIG_HOME environment variable"
+ )
+ })?;
// Check if file already exists
if config_path.exists() {
@@ -112,8 +115,11 @@ fn render_global_config(out: &mut String) -> anyhow::Result<()> {
let bold = AnstyleStyle::new().bold();
// Get config path
- let config_path = get_global_config_path()
- .ok_or_else(|| anyhow::anyhow!("Could not determine global config path"))?;
+ let config_path = get_global_config_path().ok_or_else(|| {
+ anyhow::anyhow!(
+ "Cannot determine config directory. Set $HOME or $XDG_CONFIG_HOME environment variable"
+ )
+ })?;
writeln!(
out,
diff --git a/src/commands/configure_shell.rs b/src/commands/configure_shell.rs
index ef56e01fa..00d1db49c 100644
--- a/src/commands/configure_shell.rs
+++ b/src/commands/configure_shell.rs
@@ -204,7 +204,9 @@ pub fn scan_shell_configs(
let mut skipped = Vec::new();
for shell in shells {
- let paths = shell.config_paths().map_err(|e| e.to_string())?;
+ let paths = shell
+ .config_paths()
+ .map_err(|e| format!("Failed to get config paths for {}: {}", shell, e))?;
// Find the first existing config file
let target_path = paths.iter().find(|p| p.exists());
@@ -301,7 +303,13 @@ fn configure_shell_file(
// Check for the exact conditional wrapper we would write
for line in reader.lines() {
- let line = line.map_err(|e| format!("Failed to read line: {}", e))?;
+ let line = line.map_err(|e| {
+ format!(
+ "Failed to read line from {}: {}",
+ format_path_for_display(path),
+ e
+ )
+ })?;
// Canonical detection: check if the line matches exactly what we write
if line.trim() == config_content {
@@ -571,7 +579,9 @@ pub fn process_shell_completions(
continue;
}
- let completion_path = shell.completion_path().map_err(|e| e.to_string())?;
+ let completion_path = shell
+ .completion_path()
+ .map_err(|e| format!("Failed to get completion path for {}: {}", shell, e))?;
// Check if completions already exist with correct content
if completion_path.exists() {
@@ -739,7 +749,9 @@ fn scan_for_uninstall(
continue;
}
- let completion_path = shell.completion_path().map_err(|e| e.to_string())?;
+ let completion_path = shell
+ .completion_path()
+ .map_err(|e| format!("Failed to get completion path for {}: {}", shell, e))?;
if completion_path.exists() {
if dry_run {
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 7d2241073..2879e971b 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -87,14 +87,14 @@ pub fn handle_merge(
return Err(worktrunk::git::GitError::UncommittedChanges {
action: Some("merge with --no-commit".into()),
}
- .styled_err());
+ .into());
}
// Validate --no-commit flag compatibility
if !commit && remove {
- return Err(anyhow::anyhow!(format!(
+ return Err(anyhow::anyhow!(
"{ERROR_EMOJI} {ERROR}--no-commit requires --no-remove{ERROR:#}\n\n{HINT_EMOJI} {HINT}Cannot remove active worktree when skipping commit/rebase{HINT:#}"
- )));
+ ));
}
// --no-commit implies --no-squash (validation above ensures --no-remove is already set)
@@ -216,7 +216,7 @@ pub fn handle_merge(
force_delete: false,
target_branch: Some(target_branch.clone()),
};
- crate::output::handle_remove_output(&remove_result, Some(&current_branch), true, true)?;
+ crate::output::handle_remove_output(&remove_result, Some(&current_branch), true)?;
} else {
// Print comprehensive summary (worktree preserved)
// Priority: main branch > on target > --no-remove flag
diff --git a/src/commands/process.rs b/src/commands/process.rs
index 8c0fd2635..a74523d24 100644
--- a/src/commands/process.rs
+++ b/src/commands/process.rs
@@ -1,7 +1,9 @@
+use anyhow::Context;
use std::fs;
use std::path::Path;
use std::process::{Command, Stdio};
use worktrunk::git::Repository;
+use worktrunk::path::format_path_for_display;
/// Spawn a detached background process with output redirected to a log file
///
@@ -32,8 +34,12 @@ pub fn spawn_detached(
// Create log directory in the common git directory
let log_dir = git_common_dir.join("wt-logs");
- fs::create_dir_all(&log_dir)
- .map_err(|e| anyhow::anyhow!("Failed to create log directory\n {e}"))?;
+ fs::create_dir_all(&log_dir).with_context(|| {
+ format!(
+ "Failed to create log directory {}",
+ format_path_for_display(&log_dir)
+ )
+ })?;
// Generate log filename (no timestamp - overwrites on each run)
// Format: {branch}-{name}.log (e.g., "feature-post-start-npm.log", "bugfix-remove.log")
@@ -43,8 +49,12 @@ pub fn spawn_detached(
let log_path = log_dir.join(format!("{}-{}.log", safe_branch, safe_name));
// Create log file
- let log_file = fs::File::create(&log_path)
- .map_err(|e| anyhow::anyhow!("Failed to create log file\n {e}"))?;
+ let log_file = fs::File::create(&log_path).with_context(|| {
+ format!(
+ "Failed to create log file {}",
+ format_path_for_display(&log_path)
+ )
+ })?;
#[cfg(unix)]
{
@@ -80,17 +90,19 @@ fn spawn_detached_unix(
))
.current_dir(worktree_path)
.stdin(Stdio::null())
- .stdout(Stdio::from(log_file.try_clone().map_err(|e| {
- anyhow::anyhow!(format!("Failed to clone log file handle: {}", e))
- })?))
+ .stdout(Stdio::from(
+ log_file
+ .try_clone()
+ .context("Failed to clone log file handle")?,
+ ))
.stderr(Stdio::from(log_file))
.spawn()
- .map_err(|e| anyhow::anyhow!(format!("Failed to spawn detached process\n {e}")))?;
+ .context("Failed to spawn detached process")?;
// Wait for the outer shell to exit (immediate, doesn't block on background command)
child
.wait()
- .map_err(|e| anyhow::anyhow!(format!("Failed to wait for detachment shell\n {e}")))?;
+ .context("Failed to wait for detachment shell")?;
Ok(())
}
@@ -112,13 +124,15 @@ fn spawn_detached_windows(
.args(["/C", command])
.current_dir(worktree_path)
.stdin(Stdio::null())
- .stdout(Stdio::from(log_file.try_clone().map_err(|e| {
- anyhow::anyhow!(format!("Failed to clone log file handle: {}", e))
- })?))
+ .stdout(Stdio::from(
+ log_file
+ .try_clone()
+ .context("Failed to clone log file handle")?,
+ ))
.stderr(Stdio::from(log_file))
.creation_flags(CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS)
.spawn()
- .map_err(|e| anyhow::anyhow!(format!("Failed to spawn detached process\n {e}")))?;
+ .context("Failed to spawn detached process")?;
Ok(())
}
diff --git a/src/commands/repository_ext.rs b/src/commands/repository_ext.rs
index e524036ac..087fb0988 100644
--- a/src/commands/repository_ext.rs
+++ b/src/commands/repository_ext.rs
@@ -7,10 +7,7 @@ use anyhow::Context;
use worktrunk::config::ProjectConfig;
use worktrunk::git::{GitError, Repository};
use worktrunk::path::format_path_for_display;
-use worktrunk::styling::{
- CYAN, CYAN_BOLD, ERROR, ERROR_EMOJI, HINT, HINT_BOLD, HINT_EMOJI, WARNING, WARNING_BOLD,
- format_with_gutter,
-};
+use worktrunk::styling::{CYAN, CYAN_BOLD, WARNING, WARNING_BOLD, format_with_gutter};
/// CLI-only helpers implemented on [`Repository`] via an extension trait so we can keep orphan
/// implementations inside the binary crate.
@@ -52,15 +49,7 @@ impl RepositoryCliExt for Repository {
match load_project_config_at(&repo_root)? {
Some(cfg) => Ok(cfg),
- None => {
- use worktrunk::styling::eprintln;
- eprintln!("{ERROR_EMOJI} {ERROR}No project configuration found{ERROR:#}");
- eprintln!(
- "{HINT_EMOJI} {HINT}Create a config file at: {HINT_BOLD}{}{HINT_BOLD:#}{HINT:#}",
- format_path_for_display(&config_path)
- );
- Err(anyhow::anyhow!("No project configuration found"))
- }
+ None => Err(GitError::ProjectConfigNotFound { config_path }.into()),
}
}
@@ -92,7 +81,7 @@ impl RepositoryCliExt for Repository {
return Err(GitError::NoWorktreeFound {
branch: branch_name.into(),
}
- .styled_err());
+ .into());
}
};
@@ -100,7 +89,7 @@ impl RepositoryCliExt for Repository {
return Err(GitError::WorktreeMissing {
branch: branch_name.into(),
}
- .styled_err());
+ .into());
}
let target_repo = Repository::at(&worktree_path);
@@ -163,7 +152,7 @@ impl RepositoryCliExt for Repository {
files: overlapping,
worktree_path: wt_path.clone(),
}
- .styled_err());
+ .into());
}
let nanos = SystemTime::now()
@@ -205,10 +194,10 @@ impl RepositoryCliExt for Repository {
}
let Some(stash_ref) = stash_ref else {
- return Err(anyhow::anyhow!(format!(
+ return Err(anyhow::anyhow!(
"Failed to locate autostash entry '{}'",
stash_name
- )));
+ ));
};
Ok(Some(TargetWorktreeStash::new(wt_path, stash_ref)))
diff --git a/src/commands/select.rs b/src/commands/select.rs
index 589b0bc51..7a6c182b7 100644
--- a/src/commands/select.rs
+++ b/src/commands/select.rs
@@ -602,13 +602,13 @@ pub fn handle_select(is_directive_mode: bool) -> anyhow::Result<()> {
// Legend/controls moved to preview window tabs (render_preview_tabs)
.no_clear(true) // Prevent skim from clearing screen, we'll do it manually
.build()
- .map_err(|e| anyhow::anyhow!(format!("Failed to build skim options: {}", e)))?;
+ .map_err(|e| anyhow::anyhow!("Failed to build skim options: {}", e))?;
// Create item receiver
let (tx, rx): (SkimItemSender, SkimItemReceiver) = unbounded();
for item in items {
tx.send(item)
- .map_err(|e| anyhow::anyhow!(format!("Failed to send item to skim: {}", e)))?;
+ .map_err(|e| anyhow::anyhow!("Failed to send item to skim: {}", e))?;
}
drop(tx);
diff --git a/src/commands/standalone.rs b/src/commands/standalone.rs
index 3b485f3a6..44f891bd0 100644
--- a/src/commands/standalone.rs
+++ b/src/commands/standalone.rs
@@ -57,7 +57,7 @@ fn check_hook_configured<T>(hook: &Option<T>, hook_type: HookType) -> anyhow::Re
return Err(worktrunk::git::GitError::Other {
message: format!("No {hook_type} hook configured"),
}
- .styled_err());
+ .into());
}
Ok(())
}
@@ -333,13 +333,13 @@ pub fn handle_rebase(target: Option<&str>) -> anyhow::Result<RebaseResult> {
target_branch: target_branch.clone(),
git_output,
}
- .styled_err());
+ .into());
}
// Not a rebase conflict, return original error
return Err(worktrunk::git::GitError::Other {
message: format!("Failed to rebase onto '{}': {}", target_branch, e),
}
- .styled_err());
+ .into());
}
// Verify rebase completed successfully (safety check for edge cases)
@@ -349,7 +349,7 @@ pub fn handle_rebase(target: Option<&str>) -> anyhow::Result<RebaseResult> {
target_branch: target_branch.clone(),
git_output: String::new(),
}
- .styled_err());
+ .into());
}
// Success
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index bc71adeca..56aca393a 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -221,7 +221,7 @@ pub fn handle_switch(
return Err(GitError::BranchAlreadyExists {
branch: resolved_branch.clone(),
}
- .styled_err());
+ .into());
}
// Check if base flag was provided without create flag
@@ -263,7 +263,7 @@ pub fn handle_switch(
return Err(GitError::WorktreeMissing {
branch: resolved_branch.clone(),
}
- .styled_err());
+ .into());
}
None => {}
}
@@ -273,14 +273,19 @@ pub fn handle_switch(
let repo_name = repo_root
.file_name()
- .ok_or_else(|| anyhow::anyhow!("{}", "Invalid repository path"))?
+ .ok_or_else(|| anyhow::anyhow!("Repository path has no filename: {}", repo_root.display()))?
.to_str()
- .ok_or_else(|| anyhow::anyhow!("{}", "Invalid UTF-8 in path"))?;
+ .ok_or_else(|| {
+ anyhow::anyhow!(
+ "Repository path contains invalid UTF-8: {}",
+ repo_root.display()
+ )
+ })?;
let worktree_path = repo_root.join(
config
.format_path(repo_name, &resolved_branch)
- .map_err(|e| anyhow::anyhow!(format!("Failed to format worktree path: {}", e)))?,
+ .map_err(|e| anyhow::anyhow!("Failed to format worktree path: {}", e))?,
);
// If the target path already exists but no worktree is registered for this branch,
@@ -295,7 +300,7 @@ pub fn handle_switch(
path: worktree_path,
occupant,
}
- .styled_err());
+ .into());
}
// Create the worktree
@@ -344,7 +349,7 @@ pub fn handle_switch(
return Err(GitError::WorktreePathExists {
path: normalized_path,
}
- .styled_err());
+ .into());
}
}
// Fall back to generic error with context
@@ -353,7 +358,7 @@ pub fn handle_switch(
base_branch: base_for_creation.clone(),
error: msg,
}
- .styled_err());
+ .into());
}
// Canonicalize the path to resolve any .. components
@@ -532,13 +537,13 @@ pub fn handle_push(
commits_formatted,
in_merge_context: operations.is_some(),
}
- .styled_err());
+ .into());
}
// Check for merge commits unless allowed
let has_merge_commits = repo.has_merge_commits(&target_branch, "HEAD")?;
if !allow_merge_commits && has_merge_commits {
- return Err(GitError::MergeCommitsFound.styled_err());
+ return Err(GitError::MergeCommitsFound.into());
}
// Check for conflicting changes in target worktree (auto-stash safe changes)
@@ -639,7 +644,7 @@ pub fn handle_push(
return Err(GitError::PushFailed {
error: e.to_string(),
}
- .styled_err());
+ .into());
}
if let Some(stash) = target_worktree_stash.take() {
diff --git a/src/config/user.rs b/src/config/user.rs
index 05ffd4ab7..497b1380e 100644
--- a/src/config/user.rs
+++ b/src/config/user.rs
@@ -426,7 +426,9 @@ impl WorktrunkConfig {
Some(path) => self.save_to(path),
None => {
let path = get_config_path().ok_or_else(|| {
- ConfigError::Message("Could not determine config path".to_string())
+ ConfigError::Message(
+ "Cannot determine config directory. Set $HOME or $XDG_CONFIG_HOME environment variable".to_string(),
+ )
})?;
self.save_to(&path)
}
diff --git a/src/git/error.rs b/src/git/error.rs
index 5418a5128..4702f406d 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -3,8 +3,8 @@
//! This module provides typed error handling:
//!
//! - **`GitError`** - A typed enum for domain errors that can be pattern-matched
-//! and tested. Use `.styled_err()` to convert to styled `anyhow::Error` for user
-//! display, or `.into()` to preserve the type for pattern matching.
+//! and tested. Use `.into()` to convert to `anyhow::Error` while preserving the
+//! type for pattern matching and styled display in main.rs.
//!
//! - **`WorktrunkError`** - A minimal enum for semantic errors that need
//! special handling (exit codes, silent errors).
@@ -29,11 +29,8 @@ use crate::styling::{
/// # Usage
///
/// ```ignore
-/// // Return a styled error for user display
-/// return Err(GitError::DetachedHead { action: Some("merge".into()) }.styled_err());
-///
-/// // Return a typed error for pattern matching
-/// return Err(GitError::BranchAlreadyExists { branch: "main".into() }.into());
+/// // Return a typed error (main.rs handles styled display via downcast)
+/// return Err(GitError::DetachedHead { action: Some("merge".into()) }.into());
///
/// // Pattern match on errors
/// if let Some(GitError::BranchAlreadyExists { branch }) = err.downcast_ref() {
@@ -103,10 +100,6 @@ pub enum GitError {
error: String,
},
- /// Failed to delete branch
- #[error("failed to delete branch '{branch}'")]
- BranchDeletionFailed { branch: String, error: String },
-
// -------------------------------------------------------------------------
// Merge/push errors
// -------------------------------------------------------------------------
@@ -162,6 +155,13 @@ pub enum GitError {
error: String,
},
+ /// Project configuration file not found
+ #[error("no project configuration found")]
+ ProjectConfigNotFound {
+ /// Path where config file was expected
+ config_path: PathBuf,
+ },
+
/// Generic error with custom message
#[error("{message}")]
Other { message: String },
@@ -266,13 +266,6 @@ impl GitError {
format_error_block(header, error)
}
- GitError::BranchDeletionFailed { branch, error } => {
- let header = format!(
- "{ERROR_EMOJI} {ERROR}Failed to delete branch {ERROR_BOLD}{branch}{ERROR_BOLD:#}{ERROR:#}"
- );
- format_error_block(header, error)
- }
-
GitError::ConflictingChanges {
files,
worktree_path,
@@ -364,18 +357,18 @@ impl GitError {
msg
}
+ GitError::ProjectConfigNotFound { config_path } => {
+ format!(
+ "{ERROR_EMOJI} {ERROR}No project configuration found{ERROR:#}\n\n{HINT_EMOJI} {HINT}Create a config file at: {HINT_BOLD}{}{HINT_BOLD:#}{HINT:#}",
+ format_path_for_display(config_path)
+ )
+ }
+
GitError::ParseError { message } | GitError::Other { message } => {
format!("{ERROR_EMOJI} {ERROR}{message}{ERROR:#}")
}
}
}
-
- /// Convert to anyhow::Error with styled message.
- ///
- /// This wraps the error with its styled representation for user display.
- pub fn styled_err(self) -> anyhow::Error {
- anyhow::anyhow!("{}", self.styled())
- }
}
/// Check if an error is a specific GitError variant
@@ -522,16 +515,19 @@ mod tests {
}
#[test]
- fn test_git_error_styled_err_conversion() {
- // styled_err() wraps the styled message in anyhow::Error
- let err = GitError::BranchAlreadyExists {
+ fn test_into_preserves_type_for_styled_output() {
+ // .into() preserves type so we can downcast and get styled output
+ let err: anyhow::Error = GitError::BranchAlreadyExists {
branch: "main".into(),
}
- .styled_err();
- let msg = err.to_string();
- assert!(msg.contains("❌")); // Should be styled
- assert!(msg.contains("main"));
- assert!(msg.contains("already exists"));
+ .into();
+
+ // Can downcast and get styled output
+ let git_err = err.downcast_ref::<GitError>().expect("Should downcast");
+ let styled = git_err.styled();
+ assert!(styled.contains("❌")); // Should be styled
+ assert!(styled.contains("main"));
+ assert!(styled.contains("already exists"));
}
#[test]
@@ -549,19 +545,6 @@ mod tests {
}
}
- #[test]
- fn test_styled_err_loses_type() {
- // styled_err() wraps as string, cannot be pattern matched
- let err = GitError::BranchAlreadyExists {
- branch: "feature".into(),
- }
- .styled_err();
- assert!(
- err.downcast_ref::<GitError>().is_none(),
- "styled_err() wraps as string, cannot be pattern matched"
- );
- }
-
#[test]
fn test_is_git_error_helper() {
let err: anyhow::Error = GitError::DetachedHead { action: None }.into();
diff --git a/src/git/mod.rs b/src/git/mod.rs
index 88d2356d4..13f30bcd6 100644
--- a/src/git/mod.rs
+++ b/src/git/mod.rs
@@ -124,7 +124,7 @@ impl WorktreeList {
return Err(GitError::Other {
message: "No worktrees found".into(),
}
- .styled_err());
+ .into());
}
Ok(Self { worktrees })
diff --git a/src/git/parse.rs b/src/git/parse.rs
index 576833e8b..7301a1450 100644
--- a/src/git/parse.rs
+++ b/src/git/parse.rs
@@ -28,7 +28,7 @@ impl Worktree {
return Err(GitError::ParseError {
message: "worktree line missing path".into(),
}
- .styled_err());
+ .into());
};
current = Some(Worktree {
path: PathBuf::from(path),
@@ -46,7 +46,7 @@ impl Worktree {
return Err(GitError::ParseError {
message: "HEAD line missing SHA".into(),
}
- .styled_err());
+ .into());
};
wt.head = sha.to_string();
}
@@ -56,7 +56,7 @@ impl Worktree {
return Err(GitError::ParseError {
message: "branch line missing ref".into(),
}
- .styled_err());
+ .into());
};
let branch = branch_ref
.strip_prefix("refs/heads/")
@@ -107,7 +107,7 @@ impl DefaultBranchName {
return Err(GitError::ParseError {
message: format!("Empty branch name from {}/HEAD", remote),
}
- .styled_err());
+ .into());
}
Ok(Self(branch.to_string()))
@@ -128,7 +128,7 @@ impl DefaultBranchName {
GitError::ParseError {
message: "Could not find symbolic ref in ls-remote output".into(),
}
- .styled_err()
+ .into()
})
}
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index 5ad8a22ef..764488ef7 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -100,10 +100,12 @@ impl Repository {
git_common_dir
.parent()
.ok_or_else(|| {
- GitError::Other {
- message: "Invalid git directory".into(),
- }
- .styled_err()
+ anyhow::Error::from(GitError::Other {
+ message: format!(
+ "Git directory has no parent: {}",
+ git_common_dir.display()
+ ),
+ })
})?
.to_path_buf()
};
@@ -191,7 +193,7 @@ impl Repository {
GitError::DetachedHead {
action: Some(action.into()),
}
- .styled_err()
+ .into()
})
}
@@ -270,7 +272,7 @@ impl Repository {
GitError::DetachedHead {
action: Some("resolve '@' to current branch".into()),
}
- .styled_err()
+ .into()
}),
"-" => {
// Read from worktrunk.history (recorded by wt switch operations)
@@ -283,7 +285,7 @@ impl Repository {
"No previous branch found in history. Use 'wt list' to see available worktrees."
.into(),
}
- .styled_err()
+ .into()
})
}
"^" => self.default_branch(),
@@ -376,7 +378,7 @@ impl Repository {
"Could not infer default branch. Please specify target branch explicitly or set up a remote."
.into(),
}
- .styled_err())
+ .into())
}
/// List all local branches.
@@ -446,7 +448,7 @@ impl Repository {
return Err(GitError::UncommittedChanges {
action: action.map(String::from),
}
- .styled_err());
+ .into());
}
Ok(())
}
@@ -498,7 +500,7 @@ impl Repository {
GitError::ParseError {
message: format!("Failed to parse commit count: {}", e),
}
- .styled_err()
+ .into()
})
}
@@ -523,7 +525,7 @@ impl Repository {
GitError::ParseError {
message: format!("Failed to parse timestamp: {}", e),
}
- .styled_err()
+ .into()
})
}
@@ -610,7 +612,7 @@ impl Repository {
return Err(crate::git::GitError::ParseError {
message: format!("Unexpected rev-list output format: {}", output),
}
- .styled_err());
+ .into());
}
let behind: usize = parts[0].parse().context("Failed to parse behind count")?;
@@ -785,7 +787,7 @@ impl Repository {
return Err(crate::git::GitError::Other {
message: "git stash create returned empty SHA - no changes to backup".into(),
}
- .styled_err());
+ .into());
}
// Get current branch name to use in the ref name
@@ -1042,10 +1044,9 @@ impl Repository {
/// Remove a worktree at the specified path.
pub fn remove_worktree(&self, path: &std::path::Path) -> anyhow::Result<()> {
let path_str = path.to_str().ok_or_else(|| {
- GitError::Other {
- message: "Invalid UTF-8 in worktree path".into(),
- }
- .styled_err()
+ anyhow::Error::from(GitError::Other {
+ message: format!("Worktree path contains invalid UTF-8: {}", path.display()),
+ })
})?;
self.run_command(&["worktree", "remove", path_str])?;
Ok(())
@@ -1156,10 +1157,12 @@ impl Repository {
.file_name()
.and_then(|name| name.to_str())
.ok_or_else(|| {
- GitError::Other {
- message: "Could not determine repository name".into(),
- }
- .styled_err()
+ anyhow::Error::from(GitError::Other {
+ message: format!(
+ "Repository directory has no valid name: {}",
+ repo_root.display()
+ ),
+ })
})?;
Ok(repo_name.to_string())
diff --git a/src/llm.rs b/src/llm.rs
index 84a635a93..d5a535d0d 100644
--- a/src/llm.rs
+++ b/src/llm.rs
@@ -121,7 +121,7 @@ fn execute_llm_command(command: &str, args: &[String], prompt: &str) -> anyhow::
return Err(worktrunk::git::GitError::Other {
message: "LLM returned empty message".into(),
}
- .styled_err());
+ .into());
}
Ok(message)
@@ -140,14 +140,13 @@ fn build_commit_prompt(
(None, Some(path)) => {
let expanded_path = PathBuf::from(shellexpand::tilde(path).as_ref());
std::fs::read_to_string(&expanded_path).map_err(|e| {
- worktrunk::git::GitError::Other {
+ anyhow::Error::from(worktrunk::git::GitError::Other {
message: format!(
"Failed to read template-file '{}': {}",
format_path_for_display(&expanded_path),
e
),
- }
- .styled_err()
+ })
})?
}
(None, None) => DEFAULT_TEMPLATE.to_string(),
@@ -161,7 +160,7 @@ fn build_commit_prompt(
return Err(worktrunk::git::GitError::Other {
message: "Template is empty".into(),
}
- .styled_err());
+ .into());
}
// Render template with minijinja
@@ -191,14 +190,13 @@ fn build_squash_prompt(
(None, Some(path)) => {
let expanded_path = PathBuf::from(shellexpand::tilde(path).as_ref());
std::fs::read_to_string(&expanded_path).map_err(|e| {
- worktrunk::git::GitError::Other {
+ anyhow::Error::from(worktrunk::git::GitError::Other {
message: format!(
"Failed to read squash-template-file '{}': {}",
format_path_for_display(&expanded_path),
e
),
- }
- .styled_err()
+ })
})?
}
(None, None) => DEFAULT_SQUASH_TEMPLATE.to_string(),
@@ -214,7 +212,7 @@ fn build_squash_prompt(
return Err(worktrunk::git::GitError::Other {
message: "Squash template is empty".into(),
}
- .styled_err());
+ .into());
}
// Render template with minijinja
@@ -247,7 +245,7 @@ pub fn generate_commit_message(
command: format_command_display(command, args),
error: e.to_string(),
}
- .styled_err()
+ .into()
});
}
@@ -345,7 +343,7 @@ pub fn generate_squash_message(
command: format_command_display(command, args),
error: e.to_string(),
}
- .styled_err()
+ .into()
});
}
diff --git a/src/main.rs b/src/main.rs
index 23c348382..746c82bb2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -303,7 +303,7 @@ fn main() {
return Err(worktrunk::git::GitError::Other {
message: "No shell config files found".into(),
}
- .styled_err());
+ .into());
}
// Summary
@@ -667,7 +667,7 @@ fn main() {
return Err(worktrunk::git::GitError::Other {
message: "Cannot use --force-delete with --no-delete-branch".into(),
}
- .styled_err());
+ .into());
}
let repo = Repository::current();
@@ -677,7 +677,7 @@ fn main() {
let current_branch = repo.resolve_worktree_name("@")?;
let result =
handle_remove(&current_branch, !delete_branch, force_delete, background)?;
- handle_remove_output(&result, None, false, background)
+ handle_remove_output(&result, None, background)
} else {
// When removing multiple worktrees, we need to handle the current worktree last
// to avoid deleting the directory we're currently in
@@ -708,14 +708,14 @@ fn main() {
// Progress messages shown by handle_remove_output for all cases
for resolved in &others {
let result = handle_remove(resolved, !delete_branch, force_delete, background)?;
- handle_remove_output(&result, Some(resolved), false, background)?;
+ handle_remove_output(&result, Some(resolved), background)?;
}
// Remove current worktree last (if it was in the list)
if let Some(resolved) = current {
let result =
handle_remove(&resolved, !delete_branch, force_delete, background)?;
- handle_remove_output(&result, Some(&resolved), false, background)?;
+ handle_remove_output(&result, Some(&resolved), background)?;
}
Ok(())
@@ -784,18 +784,23 @@ fn main() {
// Route through output system to respect mode:
// - Interactive mode: errors go to stdout
// - Directive mode: errors go to stderr
- //
- // Multi-line errors from external commands (e.g., git output) get gutter formatting.
- // We detect this by checking if context was added: e.to_string() != root_cause means
- // the error was wrapped with .context(), so the root cause is raw external output.
- let msg = e.to_string();
- let root_cause = e.root_cause().to_string();
- let has_context = msg != root_cause;
- if has_context && root_cause.contains('\n') {
- let _ = output::error(msg);
- let _ = output::gutter(format_with_gutter(&root_cause, "", None));
+
+ // Check if it's a typed GitError - use its styled output
+ if let Some(git_err) = e.downcast_ref::<worktrunk::git::GitError>() {
+ let _ = output::error(git_err.styled());
} else {
- let _ = output::error(msg);
+ // Anyhow error - multi-line errors from external commands get gutter formatting.
+ // We detect this by checking if context was added: e.to_string() != root_cause means
+ // the error was wrapped with .context(), so the root cause is raw external output.
+ let msg = e.to_string();
+ let root_cause = e.root_cause().to_string();
+ let has_context = msg != root_cause;
+ if has_context && root_cause.contains('\n') {
+ let _ = output::error(msg);
+ let _ = output::gutter(format_with_gutter(&root_cause, "", None));
+ } else {
+ let _ = output::error(msg);
+ }
}
// Preserve exit code from child processes (especially for signals like SIGINT)
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 17f87414a..5844358e4 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -189,7 +189,6 @@ fn build_remove_command(
pub fn handle_remove_output(
result: &RemoveResult,
branch: Option<&str>,
- strict_branch_deletion: bool,
background: bool,
) -> anyhow::Result<()> {
match result {
@@ -210,19 +209,13 @@ pub fn handle_remove_output(
*force_delete,
target_branch.as_deref(),
branch,
- strict_branch_deletion,
background,
),
RemoveResult::BranchOnly {
branch_name,
no_delete_branch,
force_delete,
- } => handle_branch_only_output(
- branch_name,
- *no_delete_branch,
- *force_delete,
- strict_branch_deletion,
- ),
+ } => handle_branch_only_output(branch_name, *no_delete_branch, *force_delete),
}
}
@@ -231,7 +224,6 @@ fn handle_branch_only_output(
branch_name: &str,
no_delete_branch: bool,
force_delete: bool,
- strict_branch_deletion: bool,
) -> anyhow::Result<()> {
use worktrunk::styling::GRAY;
@@ -283,15 +275,7 @@ fn handle_branch_only_output(
))?;
}
Err(e) => {
- if strict_branch_deletion {
- return Err(GitError::BranchDeletionFailed {
- branch: branch_name.into(),
- error: e.to_string(),
- }
- .styled_err());
- }
-
- // If branch deletion fails in non-strict mode, show a warning but don't error
+ // Show a warning but don't error - branch still exists
super::warning(format!(
"{WARNING}Could not delete branch {WARNING_BOLD}{branch_name}{WARNING_BOLD:#}{WARNING:#}"
))?;
@@ -316,7 +300,6 @@ fn handle_removed_worktree_output(
force_delete: bool,
target_branch: Option<&str>,
branch: Option<&str>,
- strict_branch_deletion: bool,
background: bool,
) -> anyhow::Result<()> {
// 1. Emit cd directive if needed - shell will execute this immediately
@@ -390,7 +373,7 @@ fn handle_removed_worktree_output(
path: worktree_path.to_path_buf(),
error: err.to_string(),
}
- .styled_err());
+ .into());
}
// Delete the branch (unless --no-delete-branch was specified)
@@ -423,15 +406,7 @@ fn handle_removed_worktree_output(
match delete_result {
Ok(_) => true,
Err(e) => {
- if strict_branch_deletion {
- return Err(GitError::BranchDeletionFailed {
- branch: branch_name.into(),
- error: e.to_string(),
- }
- .styled_err());
- }
-
- // If branch deletion fails in non-strict mode, show a warning but don't error
+ // Show a warning but don't error - branch still exists
super::warning(format!(
"{WARNING}Could not delete branch {WARNING_BOLD}{branch_name}{WARNING_BOLD:#}{WARNING:#}"
))?;
@@ -506,18 +481,16 @@ pub(crate) fn execute_streaming(
.env_remove("VERGEN_GIT_DESCRIBE")
.spawn()
.map_err(|e| {
- worktrunk::git::GitError::Other {
+ anyhow::Error::from(worktrunk::git::GitError::Other {
message: format!("Failed to execute command: {}", e),
- }
- .styled_err()
+ })
})?;
// Wait for command to complete
let status = child.wait().map_err(|e| {
- worktrunk::git::GitError::Other {
+ anyhow::Error::from(worktrunk::git::GitError::Other {
message: format!("Failed to wait for command: {}", e),
- }
- .styled_err()
+ })
})?;
// Check if child was killed by a signal (Unix only)
diff --git a/src/output/interactive.rs b/src/output/interactive.rs
index 3acecac42..8299da7bb 100644
--- a/src/output/interactive.rs
+++ b/src/output/interactive.rs
@@ -2,7 +2,7 @@
use std::io::{self, Write};
use std::path::Path;
-use worktrunk::styling::{println, stderr, stdout};
+use worktrunk::styling::{ERROR, ERROR_EMOJI, eprintln, println, stderr, stdout};
#[cfg(not(unix))]
use super::handlers::execute_streaming;
@@ -35,10 +35,20 @@ impl OutputHandler for InteractiveOutput {
self.stdout.flush()
}
+ fn error(&mut self, message: String) -> io::Result<()> {
+ // Errors go to stderr in all modes (Unix convention)
+ if message.starts_with(ERROR_EMOJI) {
+ eprintln!("{message}");
+ } else {
+ eprintln!("{ERROR_EMOJI} {ERROR}{message}{ERROR:#}");
+ }
+ stderr().flush()
+ }
+
fn gutter(&mut self, content: String) -> io::Result<()> {
- // Gutter content is pre-formatted with its own newlines
- write!(self.stdout, "{content}")?;
- self.stdout.flush()
+ // Gutter content is diagnostic/informational, not data - goes to stderr
+ write!(stderr(), "{content}")?;
+ stderr().flush()
}
fn shell_integration_hint(&mut self, message: String) -> io::Result<()> {
diff --git a/src/shell.rs b/src/shell.rs
index f21e22bf3..bb4e9c1ee 100644
--- a/src/shell.rs
+++ b/src/shell.rs
@@ -7,7 +7,7 @@ fn home_dir() -> Result<PathBuf, std::io::Error> {
home::home_dir().ok_or_else(|| {
std::io::Error::new(
std::io::ErrorKind::NotFound,
- "Could not determine home directory",
+ "Cannot determine home directory. Set $HOME environment variable",
)
})
}
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index adadffd06..49de9cb39 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -264,9 +264,9 @@ fn test_configure_shell_no_files() {
💡 Skipped bash; ~/.bashrc not found
💡 Skipped zsh; ~/.zshrc not found
💡 Skipped fish; ~/.config/fish/conf.d not found
- ❌ No shell config files found
----- stderr -----
+ ❌ No shell config files found
");
});
}
diff --git a/tests/integration_tests/directives.rs b/tests/integration_tests/directives.rs
index 3885bafbb..8833d7489 100644
--- a/tests/integration_tests/directives.rs
+++ b/tests/integration_tests/directives.rs
@@ -55,11 +55,10 @@ fn test_switch_without_internal() {
success: false
exit_code: 1
----- stdout -----
- ❌ Failed to create worktree for my-feature
-   fatal: invalid reference: my-feature
-
----- stderr -----
+ ❌ Failed to create worktree for my-feature
+   fatal: invalid reference: my-feature
");
});
}
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index 8573b7ed8..c6a931017 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -667,7 +667,7 @@ fn test_merge_squash_llm_error() {
repo.setup_remote("main");
// Create a worktree for main
- let main_wt = repo.root_path().parent().unwrap().join("test-repo.main-wt");
+ let main_wt = repo.root_path().parent().unwrap().join("repo.main-wt");
let mut cmd = Command::new("git");
repo.configure_git_cmd(&mut cmd);
cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"])
@@ -2453,13 +2453,13 @@ fn test_merge_no_commit_with_clean_tree() {
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-   * [SHA] Add feature file
-   feature.txt | 1 +
-   1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
⚪ Worktree preserved (--no-remove)
----- stderr -----
+   * [SHA] Add feature file
+   feature.txt | 1 +
+   1 file changed, 1 insertion(+)
");
});
}
@@ -2500,11 +2500,11 @@ fn test_merge_no_commit_with_dirty_tree() {
success: false
exit_code: 1
----- stdout -----
+
+ ----- stderr -----
❌ Cannot merge with --no-commit: working tree has uncommitted changes
💡 Commit or stash them first
-
- ----- stderr -----
");
});
}
@@ -2556,13 +2556,13 @@ fn test_merge_no_commit_no_squash_no_remove_redundant() {
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-   * [SHA] Add feature file
-   feature.txt | 1 +
-   1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
⚪ Worktree preserved (--no-remove)
----- stderr -----
+   * [SHA] Add feature file
+   feature.txt | 1 +
+   1 file changed, 1 insertion(+)
");
});
}
@@ -3526,3 +3526,100 @@ fn test_step_commit_nothing_to_commit() {
],
);
}
+
+// =============================================================================
+// Error message snapshot tests
+// =============================================================================
+
+#[test]
+fn test_merge_error_uncommitted_changes_with_no_commit() {
+ // Tests the `uncommitted_changes()` error function when using --no-commit with dirty tree
+ let mut repo = TestRepo::new();
+ repo.commit("Initial commit");
+ repo.setup_remote("main");
+
+ // Create a worktree for main
+ let main_wt = repo.root_path().parent().unwrap().join("repo.main-wt");
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["worktree", "add", main_wt.to_str().unwrap(), "main"])
+ .current_dir(repo.root_path())
+ .output()
+ .unwrap();
+
+ // Create a feature worktree
+ let feature_wt = repo.add_worktree("feature");
+
+ // Make uncommitted changes (dirty working tree)
+ fs::write(feature_wt.join("dirty.txt"), "uncommitted content").unwrap();
+
+ // Try to merge with --no-commit - should fail because working tree is dirty
+ snapshot_merge(
+ "merge_error_uncommitted_changes_no_commit",
+ &repo,
+ &["main", "--no-commit", "--no-remove"],
+ Some(&feature_wt),
+ );
+}
+
+#[test]
+fn test_merge_error_conflicting_changes_in_target() {
+ // Tests the `conflicting_changes()` error function when target worktree has
+ // uncommitted changes that overlap with files being pushed
+ let mut repo = TestRepo::new();
+ repo.commit("Initial commit");
+ repo.setup_remote("main");
+
+ // Switch primary worktree off main so we can create a worktree for main
+ repo.switch_primary_to("develop");
+
+ // Create a worktree for main
+ let main_wt = repo.root_path().parent().unwrap().join("repo.main-wt");
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ let output = cmd
+ .args(["worktree", "add", main_wt.to_str().unwrap(), "main"])
+ .current_dir(repo.root_path())
+ .output()
+ .unwrap();
+ assert!(
+ output.status.success(),
+ "git worktree add failed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ // Create a feature worktree and commit a change to shared.txt
+ let feature_wt = repo.add_worktree("feature");
+ fs::write(feature_wt.join("shared.txt"), "feature content").unwrap();
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["add", "shared.txt"])
+ .current_dir(&feature_wt)
+ .output()
+ .unwrap();
+
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["commit", "-m", "Add shared.txt on feature"])
+ .current_dir(&feature_wt)
+ .output()
+ .unwrap();
+
+ // Now make uncommitted changes to shared.txt in main worktree
+ // This creates a conflict - we're trying to push changes to shared.txt
+ // but main has uncommitted changes to the same file
+ fs::write(
+ main_wt.join("shared.txt"),
+ "conflicting uncommitted content",
+ )
+ .unwrap();
+
+ // Try to merge - should fail because of conflicting uncommitted changes
+ snapshot_merge(
+ "merge_error_conflicting_changes",
+ &repo,
+ &["main"],
+ Some(&feature_wt),
+ );
+}
diff --git a/tests/integration_tests/readme_sync.rs b/tests/integration_tests/readme_sync.rs
index 0c606857c..d2a0314c2 100644
--- a/tests/integration_tests/readme_sync.rs
+++ b/tests/integration_tests/readme_sync.rs
@@ -73,6 +73,92 @@ fn strip_ansi(text: &str) -> String {
ANSI_LITERAL_REGEX.replace_all(&text, "").to_string()
}
+/// Check if a line is gutter-formatted content (has the white background ANSI code)
+fn is_gutter_line(line: &str) -> bool {
+ line.starts_with("[107m") || line.starts_with("\x1b[107m")
+}
+
+/// Check if a line is a command gutter (gutter line with blue command name)
+fn is_command_gutter(line: &str) -> bool {
+ is_gutter_line(line) && line.contains("[34m")
+}
+
+/// Split stderr into logical chunks for interleaving with stdout
+///
+/// Chunks are split at command gutter boundaries and at transitions between
+/// command output and regular gutter content.
+fn split_stderr_chunks(stderr: &str) -> Vec<String> {
+ let mut chunks = Vec::new();
+ let mut current_chunk = Vec::new();
+ let mut in_command_section = false;
+
+ for line in stderr.lines() {
+ if is_command_gutter(line) {
+ // New command section - save previous chunk if any
+ if !current_chunk.is_empty() {
+ chunks.push(current_chunk.join("\n"));
+ current_chunk = Vec::new();
+ }
+ current_chunk.push(line.to_string());
+ in_command_section = true;
+ } else if is_gutter_line(line) && in_command_section {
+ // Non-command gutter after command section - new content section
+ if !current_chunk.is_empty() {
+ chunks.push(current_chunk.join("\n"));
+ current_chunk = Vec::new();
+ }
+ current_chunk.push(line.to_string());
+ in_command_section = false;
+ } else {
+ // Continue current chunk
+ current_chunk.push(line.to_string());
+ }
+ }
+
+ if !current_chunk.is_empty() {
+ chunks.push(current_chunk.join("\n"));
+ }
+
+ chunks
+}
+
+/// Combine stdout and stderr by inserting stderr content after trigger lines
+///
+/// The pattern is:
+/// - Certain stdout lines trigger stderr content (commit messages, commands, etc.)
+/// - stderr is split into chunks that correspond to these triggers
+/// - All stderr content is included (gutter + child process output)
+fn combine_stdout_stderr(stdout: &str, stderr: &str) -> String {
+ if stderr.is_empty() {
+ return stdout.to_string();
+ }
+
+ let stdout_lines: Vec<&str> = stdout.lines().collect();
+ let mut stderr_chunks: std::collections::VecDeque<String> = split_stderr_chunks(stderr).into();
+ let mut result = Vec::new();
+
+ for stdout_line in stdout_lines {
+ result.push(stdout_line.to_string());
+
+ // Check if this line triggers stderr content
+ let triggers_stderr = stdout_line.contains("Generating")
+ || stdout_line.contains("Running pre-")
+ || stdout_line.contains("Running post-")
+ || (stdout_line.contains("Merging") && stdout_line.contains("commit"));
+
+ if triggers_stderr && let Some(chunk) = stderr_chunks.pop_front() {
+ result.push(chunk);
+ }
+ }
+
+ // Append any remaining stderr chunks (shouldn't normally happen)
+ for chunk in stderr_chunks {
+ result.push(chunk);
+ }
+
+ result.join("\n")
+}
+
/// Parse content from an insta snapshot file
fn parse_snapshot(path: &Path) -> Result<String, String> {
let content = fs::read_to_string(path)
@@ -116,8 +202,8 @@ fn parse_snapshot(path: &Path) -> Result<String, String> {
String::new()
};
- // Use stdout if it has content, otherwise stderr
- if !stdout.is_empty() { stdout } else { stderr }
+ // Combine stdout and stderr by inserting gutter content after trigger lines
+ combine_stdout_stderr(&stdout, &stderr)
} else {
content
};
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index c72ddb740..570f48420 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -602,3 +602,37 @@ fn test_switch_internal_execute_with_output_before_exit() {
&["--internal"],
);
}
+
+// =============================================================================
+// Error message snapshot tests
+// =============================================================================
+
+/// Test the `worktree_path_occupied` error when target path exists but isn't a worktree
+#[test]
+fn test_switch_error_path_occupied() {
+ let repo = setup_switch_repo();
+
+ // Calculate where the worktree would be created
+ // Default path pattern is {repo_name}.{branch}
+ let repo_name = repo.root_path().file_name().unwrap().to_str().unwrap();
+ let expected_path = repo
+ .root_path()
+ .parent()
+ .unwrap()
+ .join(format!("{}.occupied-branch", repo_name));
+
+ // Create a non-worktree directory at that path
+ std::fs::create_dir_all(&expected_path).unwrap();
+ std::fs::write(expected_path.join("some_file.txt"), "occupant content").unwrap();
+
+ // Try to create a worktree with a branch that would use that path
+ // Should fail with worktree_path_occupied error
+ snapshot_switch(
+ "switch_error_path_occupied",
+ &repo,
+ &["--create", "occupied-branch"],
+ );
+
+ // Cleanup
+ std::fs::remove_dir_all(&expected_path).ok();
+}
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap b/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap
index 3f12f5677..8e0da2f92 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__already_approved_skip_prompt.snap
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,9 +24,9 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'approved' > output.txt
✅ Created new worktree for test-approved from main at [REPO].test-approved
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  echo 'approved' > output.txt

diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap
index 2bd6ed8d7..2ee2bf4a1 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_fails_in_non_tty.snap
@@ -16,19 +16,20 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 1 command:
⚪ post-create:
  echo 'test command'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
index 483996a55..e521d8821 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_mixed_approved_unapproved.snap
@@ -4,9 +4,6 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 2 commands:
@@ -16,3 +13,7 @@ exit_code: 1
⚪ post-create:
  echo 'Third command'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap
index 445742b7e..b1d77e44b 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_multiple_commands.snap
@@ -4,9 +4,6 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 4 commands:
@@ -22,3 +19,7 @@ exit_code: 1
⚪ post-create:
  cd [REPO].test-nested-branch && pwd
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
index 50dcdf3eb..0fd6894f3 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_named_commands.snap
@@ -4,9 +4,6 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 3 commands:
@@ -19,3 +16,7 @@ exit_code: 1
⚪ post-create test:
  echo 'Running tests...'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
index 5bfcfca3d..7d87b3f4c 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__approval_single_command.snap
@@ -4,12 +4,13 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 1 command:
⚪ post-create:
  echo 'Worktree path: [REPO].feature-test-approval'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
index 483996a55..e521d8821 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__decline_approval_skips_only_unapproved.snap
@@ -4,9 +4,6 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 2 commands:
@@ -16,3 +13,7 @@ exit_code: 1
⚪ post-create:
  echo 'Third command'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__force_bypasses_tty_check.snap b/tests/snapshots/integration__integration_tests__approval_ui__force_bypasses_tty_check.snap
index 854102707..1884a44c9 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__force_bypasses_tty_check.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__force_bypasses_tty_check.snap
@@ -17,7 +17,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,9 +25,9 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'test command'
✅ Created new worktree for test-force-tty from main at [REPO].test-force-tty
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  echo 'test command'
test command
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_first_run.snap b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_first_run.snap
index 4b07a882e..fdf5df4fc 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_first_run.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_first_run.snap
@@ -17,7 +17,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,9 +25,9 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'test command' > output.txt
✅ Created new worktree for test-force from main at [REPO].test-force
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  echo 'test command' > output.txt

diff --git a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
index 6d7a47c5b..60161fd42 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__force_does_not_save_approvals_second_run.snap
@@ -4,12 +4,13 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 1 command:
⚪ post-create:
  echo 'test command' > output.txt
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap
index 29d3d606a..ce66a8375 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_post_merge_requires_approval.snap
@@ -4,12 +4,13 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 1 command:
⚪ post-merge:
  echo 'Post-merge cleanup for main'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap
index 6fd167a8a..6941121fa 100644
--- a/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap
+++ b/tests/snapshots/integration__integration_tests__approval_ui__run_hook_pre_merge_requires_approval.snap
@@ -4,12 +4,13 @@ expression: combined
---
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 1 command:
⚪ pre-merge:
  echo 'Running pre-merge checks on main'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap b/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap
index c824f3412..afbb7a961 100644
--- a/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap
+++ b/tests/snapshots/integration__integration_tests__approvals__add_approvals_all_none_approved.snap
@@ -17,19 +17,20 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
-❌ Cannot prompt for approval in non-interactive environment
-
-💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
----- stderr -----
🟡 repo needs approval to execute 1 command:
⚪ post-create:
  echo 'test'
+
+❌ Cannot prompt for approval in non-interactive environment
+
+💡 In CI/CD, use --force to skip prompts. To pre-approve commands, use 'wt config approvals add'
diff --git a/tests/snapshots/integration__integration_tests__approvals__add_approvals_no_config.snap b/tests/snapshots/integration__integration_tests__approvals__add_approvals_no_config.snap
index f3dc8e376..b800dec35 100644
--- a/tests/snapshots/integration__integration_tests__approvals__add_approvals_no_config.snap
+++ b/tests/snapshots/integration__integration_tests__approvals__add_approvals_no_config.snap
@@ -16,14 +16,15 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
-❌ No project configuration found
----- stderr -----
❌ No project configuration found
+
💡 Create a config file at: [REPO]/.config/wt.toml
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 bbf1d0391..3e4899a83 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,14 +25,14 @@ exit_code: 0
🔄 Squashing 2 commits & working tree changes into a single commit (2 files, +2)...
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
-  fix: update file 1 content
✅ Squashed @ [SHA]
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] fix: update file 1 content
-  file1.txt | 1 +
-  file2.txt | 1 +
-  2 files changed, 2 insertions(+)
✅ Merged to main (1 commit, 2 files, +2)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  fix: update file 1 content
+  * [SHA] fix: update file 1 content
+  file1.txt | 1 +
+  file2.txt | 1 +
+  2 files changed, 2 insertions(+)
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 306bbba4e..f2716b7b4 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -25,16 +26,16 @@ exit_code: 0
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
+✅ Merged to main (1 commit, 1 file, +1)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: initial feature
-✅ Squashed @ [SHA]
-🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
  * [SHA] Squash commits from main
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
-✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
-
------ 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 1ee9ac5ed..e2110dbf1 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,13 +25,13 @@ exit_code: 0
🔄 Squashing 1 commit & working tree changes into a single commit (1 file, +1)...
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
-  fix: improve auth validation logic
✅ Squashed @ [SHA]
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] fix: improve auth validation logic
-  auth.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  fix: improve auth validation logic
+  * [SHA] fix: improve auth validation logic
+  auth.txt | 1 +
+  1 file changed, 1 insertion(+)
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 c52edca1b..dee7ae897 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
@@ -15,23 +15,24 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🟡 Auto-staging 1 untracked file:
-  dirty.txt
🔄 Committing changes with default message... (1 file, +1, no squashing needed)
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
-  Changes to dirty.txt
✅ Committed changes @ [SHA]
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] Changes to dirty.txt
-  dirty.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  dirty.txt
+  Changes to dirty.txt
+  * [SHA] Changes to dirty.txt
+  dirty.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
new file mode 100644
index 000000000..243ce50f5
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
@@ -0,0 +1,31 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - merge
+ - main
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+❌ Cannot push: conflicting uncommitted changes in:
+
+  shared.txt
+
+💡 Commit or stash these changes in [REPO].main-wt first
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 0d32fca47..831097d91 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
@@ -15,14 +15,15 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
+
+----- stderr -----
❌ Cannot merge: not on a branch (detached HEAD)
💡 Switch to a branch first with 'git switch <branch>'
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_no_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_no_commit.snap
new file mode 100644
index 000000000..ecde15a40
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_uncommitted_changes_no_commit.snap
@@ -0,0 +1,31 @@
+---
+source: tests/integration_tests/merge.rs
+info:
+ program: wt
+ args:
+ - merge
+ - main
+ - "--no-commit"
+ - "--no-remove"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+❌ Cannot merge with --no-commit: working tree has uncommitted changes
+
+💡 Commit or stash them first
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 c7dd46d73..121a89398 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_not_fast_forward.snap
index f9cd76a10..89e3885b8 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_not_fast_forward.snap
@@ -17,16 +17,16 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
+
+----- stderr -----
❌ Can't push to local main branch: it has newer commits
  * [SHA] Add main file
💡 Run 'wt merge' again to incorporate these changes
-
------ 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 fb6bfbb70..97a2f2b87 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
@@ -15,23 +15,24 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🟡 Auto-staging 1 untracked file:
-  newfile.txt
🔄 Committing changes with default message... (1 file, +1, no squashing needed)
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
-  Changes to newfile.txt
✅ Committed changes @ [SHA]
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] Changes to newfile.txt
-  newfile.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing no-commits-dirty worktree & branch in background
----- stderr -----
+  newfile.txt
+  Changes to newfile.txt
+  * [SHA] Changes to newfile.txt
+  newfile.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
index fe4f33011..ecacd8573 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
@@ -14,17 +14,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 4905893a8..48f3dfb7c 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
@@ -16,19 +16,20 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 2 commits to main @ [SHA] (no commit/squash/rebase needed)
+✅ Merged to main (2 commits, 2 files, +2)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
  * [SHA] feat: add file 2
  * [SHA] feat: add file 1
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
-✅ Merged to main (2 commits, 2 files, +2)
-🔄 Removing feature worktree & branch in background
-
------ 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 c7dd46d73..121a89398 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
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 f59d781be..bbbfba0de 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,17 +24,16 @@ success: false
exit_code: 1
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
🔄 Running post-merge:
-  exit 1
🟡 Command failed: exit status: 1
-❌ post-merge command failed: exit status: 1
-
-💡 Use --no-verify to skip post-merge commands
----- stderr -----
-
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
+  exit 1
+❌ post-merge command failed: exit status: 1
+
+💡 Use --no-verify to skip post-merge commands
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 0828b7534..8221376d0 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,15 +24,15 @@ success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
🔄 Running post-merge notify:
-  echo 'Merge to main complete' > notify.txt
🔄 Running post-merge deploy:
-  echo 'Deploying branch feature' > deploy.txt
----- stderr -----
-
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
+  echo 'Merge to main complete' > notify.txt
+  echo 'Deploying branch feature' > deploy.txt
+
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 a0af1cefd..de5599e2f 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
@@ -17,17 +17,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 7ee0ed36e..5b5e9a827 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,13 +24,13 @@ success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
🔄 Running post-merge:
-  echo 'merged feature to main' > post-merge-ran.txt
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
+  echo 'merged feature to main' > post-merge-ran.txt

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_from_main_branch.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_from_main_branch.snap
index 013fa2259..238492c42 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_from_main_branch.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_from_main_branch.snap
@@ -15,7 +15,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,7 +25,7 @@ exit_code: 0
⚪ Already up to date with main (no new commits, no rebase needed)
⚪ Worktree preserved (on main branch)
🔄 Running post-merge:
-  echo 'post-merge ran from main' > post-merge-ran.txt
----- stderr -----
+  echo 'post-merge ran from main' > post-merge-ran.txt

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap
index eb3374b37..d61c82505 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -26,7 +26,7 @@ exit_code: 0
⚪ Already up to date with main (no new commits, no rebase needed)
🔄 Removing feature worktree & branch in background
🔄 Running post-merge:
-  echo 'post-merge ran' > post-merge-ran.txt
----- stderr -----
+  echo 'post-merge ran' > post-merge-ran.txt

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 28f4c169c..b4192e1e2 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,12 +24,11 @@ success: false
exit_code: 1
----- stdout -----
🟡 Auto-staging 1 untracked file:
-  feature.txt
🔄 Running pre-commit:
+
+----- stderr -----
+  feature.txt
  exit 1
-❌ pre-commit command failed: 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_commit_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
index 840aef8a8..716890c56 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,19 +24,19 @@ success: true
exit_code: 0
----- stdout -----
🟡 Auto-staging 1 untracked file:
-  feature.txt
🔄 Running pre-commit:
-  echo 'Pre-commit check passed'
🔄 Committing changes with default message... (1 file, +1, no squashing needed)
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
-  Changes to feature.txt
✅ Committed changes @ [SHA]
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] Changes to feature.txt
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  feature.txt
+  echo 'Pre-commit check passed'
Pre-commit check passed
+  Changes to feature.txt
+  * [SHA] Changes to feature.txt
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 cf3f5e087..7f515a305 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,10 +24,9 @@ success: false
exit_code: 1
----- stdout -----
🔄 Running pre-merge:
+
+----- stderr -----
  exit 1
-❌ pre-merge command failed: 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_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
index 51e2dd3e9..256812169 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,17 +24,16 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running pre-merge format:
-  exit 0
🔄 Running pre-merge lint:
-  exit 0
🔄 Running pre-merge test:
-  exit 0
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
-
+  exit 0
+  exit 0
+  exit 0
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 e6f7b1f37..f0e239890 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,13 +24,12 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running pre-merge:
-  exit 0
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
-
+  exit 0
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 0e40d5899..4444c28df 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,10 +24,9 @@ success: false
exit_code: 1
----- stdout -----
🔄 Running pre-commit:
+
+----- stderr -----
  exit 1
-❌ pre-commit command failed: 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_squash_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
index a9d6f9d62..52c31f16d 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
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,13 +24,13 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running pre-commit:
-  echo 'Pre-commit check passed'
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  echo 'Pre-commit check passed'
Pre-commit check passed
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 50d8896d6..d86a9cf8d 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
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature-from-develop worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 b4d049df8..62487973f 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,10 +25,10 @@ exit_code: 0
🔄 Rebasing onto main...
✅ Rebased onto main
🔄 Merging 1 commit to main @ [SHA] (no commit/squash needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature-dirty-primary worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
index a8f28a124..eb95a78be 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
@@ -16,17 +16,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
⚪ Worktree preserved (--no-remove)
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 e6ee121c4..1c6233951 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap
@@ -15,7 +15,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -23,12 +23,11 @@ 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
  Could not apply [SHA]... # Update shared.txt in feature
  Auto-merging shared.txt
  CONFLICT (content): Merge conflict in shared.txt
-
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap
index 829ce71c5..6c5ed801f 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,10 +25,10 @@ exit_code: 0
🔄 Rebasing onto main...
✅ Rebased onto main
🔄 Merging 1 commit to main @ [SHA] (no commit/squash needed)
-  * [SHA] Add feature
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing true-rebase-test worktree & branch in background
----- stderr -----
+  * [SHA] Add feature
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 0f12f382b..f2b813283 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,20 +25,20 @@ exit_code: 0
🔄 Squashing 3 commits into a single commit (3 files, +3)...
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
+✅ Merged to main (1 commit, 3 files, +3)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: add file 1
  - fix: update logic
  - docs: update readme
-✅ Squashed @ [SHA]
-🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
  * [SHA] Squash commits from main
  file1.txt | 1 +
  file2.txt | 1 +
  file3.txt | 1 +
  3 files changed, 3 insertions(+)
-✅ Merged to main (1 commit, 3 files, +3)
-🔄 Removing feature worktree & branch in background
-
------ 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 3a3dab504..5348840e5 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,14 +25,14 @@ exit_code: 0
🔄 Squashing 3 commits into a single commit...
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+⚪ No changes after squashing 3 commits
+⚪ Already up to date with main (no new commits, no rebase needed)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - Change 1
  - Change 2
  - Revert to initial
-⚪ No changes after squashing 3 commits
-⚪ Already up to date with main (no new commits, no rebase needed)
-🔄 Removing feature worktree & branch in background
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_error.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_error.snap
index d1fac1ec5..f5bbfbd9b 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_error.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_error.snap
@@ -15,7 +15,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,10 +24,10 @@ exit_code: 1
----- stdout -----
🔄 Squashing 2 commits into a single commit (2 files, +2)...
🔄 Generating squash commit message...
+
+----- stderr -----
❌ Commit generation command failed
  Error: connection refused
⚪ Ran command:
  sh -c echo 'Error: connection refused' >&2 && exit 1
-
------ 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 8988c6311..0d3db0dcb 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__COMMAND: nonexistent-llm-command
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,18 +26,18 @@ exit_code: 0
🔄 Squashing 2 commits into a single commit (2 files, +2)...
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
+✅ Merged to main (1 commit, 2 files, +2)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: new feature
  - fix: bug fix
-✅ Squashed @ [SHA]
-🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
  * [SHA] Squash commits from main
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
-✅ Merged to main (1 commit, 2 files, +2)
-🔄 Removing feature worktree & branch in background
-
------ 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 187df6883..e55911d7a 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
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] feat: single commit
-  file1.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] feat: single commit
+  file1.txt | 1 +
+  1 file changed, 1 insertion(+)
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 8a2c7cb61..bcc23b707 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -23,13 +24,13 @@ exit_code: 0
----- stdout -----
🔄 Squashing 2 commits into a single commit (1 file, +1)...
🔄 Generating squash commit message...
-  feat: implement user authentication system
✅ Squashed @ [SHA]
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] feat: implement user authentication system
-  auth.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  feat: implement user authentication system
+  * [SHA] feat: implement user authentication system
+  auth.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap
index 9959f842a..22caa3ef3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update files"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -27,18 +28,18 @@ exit_code: 0
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
+✅ Merged to main (1 commit, 2 files, +2)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: add file 1
  - feat: add file 2
-✅ Squashed @ [SHA]
-🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
  * [SHA] Squash commits from main
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
-✅ Merged to main (1 commit, 2 files, +2)
-🔄 Removing feature worktree & branch in background
-
------ 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 fe4f33011..ecacd8573 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
@@ -14,17 +14,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 137a7e7d2..1d8508145 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,10 +25,10 @@ exit_code: 0
🔄 Rebasing onto staging...
✅ Rebased onto staging
🔄 Merging 1 commit to staging @ [SHA] (no commit/squash needed)
-  * [SHA] Add feature for staging
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to staging (1 commit, 1 file, +1)
🔄 Removing feature-for-staging worktree & branch in background
----- stderr -----
+  * [SHA] Add feature for staging
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap b/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap
index c7dd46d73..121a89398 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
index 3edb2d7dd..2a76adda3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
🔄 Removing feature worktree & branch in background
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
index a8f28a124..eb95a78be 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
@@ -16,17 +16,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
⚪ Worktree preserved (--no-remove)
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 957afbcef..ae3705360 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
@@ -15,7 +15,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: commit changes"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -24,24 +25,24 @@ success: true
exit_code: 0
----- stdout -----
🟡 Auto-staging 2 untracked files:
-  untracked1.txt
-  untracked2.txt
🔄 Squashing 1 commit & working tree changes into a single commit (3 files, +3)...
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
+✅ Merged to main (1 commit, 3 files, +3)
+🔄 Removing feature worktree & branch in background
+
+----- stderr -----
+  untracked1.txt
+  untracked2.txt
  Squash commits from main
 
  Combined commits:
  - feat: add file 1
-✅ Squashed @ [SHA]
-🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
  * [SHA] Squash commits from main
  file1.txt | 1 +
  untracked1.txt | 1 +
  untracked2.txt | 1 +
  3 files changed, 3 insertions(+)
-✅ Merged to main (1 commit, 3 files, +3)
-🔄 Removing feature worktree & branch in background
-
------ 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 77633ab8e..44cb6507e 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -26,6 +26,15 @@ exit_code: 0
----- stdout -----
🔄 Squashing 3 commits into a single commit (3 files, +33)...
🔄 Generating squash commit message...
+✅ Squashed @ [SHA]
+🔄 Running pre-merge test:
+🔄 Running pre-merge lint:
+🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
+✅ Merged to main (1 commit, 3 files, +33)
+🔄 Removing feature-auth worktree & branch in background
+🔄 Running post-merge install:
+
+----- stderr -----
  feat(auth): Implement JWT authentication system
 
  Add comprehensive JWT token handling including validation, refresh logic,
@@ -35,23 +44,7 @@ exit_code: 0
  - Implement token refresh mechanism with expiry handling
  - Add JWT encoding/decoding with signature verification
  - Create test suite covering all authentication flows
-✅ Squashed @ [SHA]
-🔄 Running pre-merge test:
  cargo test
-🔄 Running pre-merge lint:
-  cargo clippy
-🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] feat(auth): Implement JWT authentication system
-  auth.rs | 8 ++++++++
-  auth_test.rs | 17 +++++++++++++++++
-  jwt.rs | 8 ++++++++
-  3 files changed, 33 insertions(+)
-✅ Merged to main (1 commit, 3 files, +33)
-🔄 Removing feature-auth worktree & branch in background
-🔄 Running post-merge install:
-  cargo install --path .
-
------ stderr -----
 Finished test [unoptimized + debuginfo] target(s) in 0.12s
Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)
@@ -62,8 +55,15 @@ test auth::tests::test_token_refresh ... ok
test auth::tests::test_token_validation ... ok
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
+  cargo clippy
 Checking worktrunk v0.1.0
Finished dev [unoptimized + debuginfo] target(s) in 1.23s
+  * [SHA] feat(auth): Implement JWT authentication system
+  auth.rs | 8 ++++++++
+  auth_test.rs | 17 +++++++++++++++++
+  jwt.rs | 8 ++++++++
+  3 files changed, 33 insertions(+)
+  cargo install --path .
 Installing worktrunk v0.1.0
Compiling worktrunk v0.1.0
Finished release [optimized] target(s) in 2.34s
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_post_create.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_post_create.snap
index 798dd6e00..20154d349 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_post_create.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_post_create.snap
@@ -18,7 +18,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -26,13 +26,13 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create install:
-  uv sync
✅ Created new worktree for feature-x from main at [REPO].feature-x
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start dev:
-  uv run dev
----- stderr -----
+  uv sync

Resolved 24 packages in 145ms
Installed 24 packages in 1.2s
+  uv run dev
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 4b100fb77..ae22f8506 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
@@ -17,7 +17,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -26,24 +26,19 @@ exit_code: 0
----- stdout -----
🔄 Squashing 3 commits into a single commit (2 files, +45)...
🔄 Generating squash commit message...
-  feat(api): Add user authentication endpoints
- 
-  Implement login and token refresh endpoints with JWT validation.
-  Includes comprehensive test coverage and input validation.
✅ Squashed @ [SHA]
🔄 Running pre-merge test:
-  uv run pytest
🔄 Running pre-merge lint:
-  uv run ruff check
🔄 Merging 1 commit to main @ [SHA] (no rebase needed)
-  * [SHA] feat(api): Add user authentication endpoints
-  api/auth.py | 31 +++++++++++++++++++++++++++++++
-  tests/test_auth.py | 14 ++++++++++++++
-  2 files changed, 45 insertions(+)
✅ Merged to main (1 commit, 2 files, +45)
🔄 Removing feature-auth worktree & branch in background
----- stderr -----
+  feat(api): Add user authentication endpoints
+ 
+  Implement login and token refresh endpoints with JWT validation.
+  Includes comprehensive test coverage and input validation.
+  uv run pytest

============================= test session starts ==============================
collected 3 items
@@ -54,5 +49,11 @@ tests/test_auth.py::test_token_validation PASSED [100%]
============================== 3 passed in 0.8s ===============================
+  uv run ruff check

All checks passed!
+
+  * [SHA] feat(api): Add user authentication endpoints
+  api/auth.py | 31 +++++++++++++++++++++++++++++++
+  tests/test_auth.py | 14 ++++++++++++++
+  2 files changed, 45 insertions(+)
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 a2127afd0..420e1d7b6 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
@@ -15,17 +15,18 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Merging 1 commit to main @ [SHA] (no commit/squash/rebase needed)
-  * [SHA] Implement JWT validation
-  auth.rs | 13 +++++++++++++
-  1 file changed, 13 insertions(+)
✅ Merged to main (1 commit, 1 file, +13)
🔄 Removing fix-auth worktree & branch in background
----- stderr -----
+  * [SHA] Implement JWT validation
+  auth.rs | 13 +++++++++++++
+  1 file changed, 13 insertions(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap
index 3c200a9d9..d0898fed4 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_both_flags.snap
@@ -17,7 +17,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update file"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -28,7 +29,7 @@ exit_code: 0
💡 Skipping pre-commit hook (--no-verify)
🔄 Committing tracked changes with default message... (1 file, +1, -1)
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
-  Changes to tracked.txt
✅ Committed changes @ [SHA]
----- stderr -----
+  Changes to tracked.txt
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap
index 7915be617..1e5f7c309 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_no_verify.snap
@@ -16,7 +16,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "feat: add file"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -26,11 +27,11 @@ exit_code: 0
----- stdout -----
💡 Skipping pre-commit hook (--no-verify)
🟡 Auto-staging 2 untracked files:
-  .config/
-  file1.txt
🔄 Committing changes with default message... (2 files, +2)
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
-  Changes to wt.toml & file1.txt
✅ Committed changes @ [SHA]
----- stderr -----
+  .config/
+  file1.txt
+  Changes to wt.toml & file1.txt
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_nothing_to_commit.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_nothing_to_commit.snap
index 9d5cc380f..8a73e4822 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_nothing_to_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_nothing_to_commit.snap
@@ -16,7 +16,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "feat: this should fail"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
@@ -27,9 +27,9 @@ exit_code: 1
----- stdout -----
🔄 Committing changes with default message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+
+----- stderr -----
  WIP: Changes
❌ Failed to commit
  On branch main
  nothing to commit, working tree clean
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap
index 1c127e17d..1827abec8 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_stage_tracked.snap
@@ -16,7 +16,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "fix: update tracked file"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -26,7 +27,7 @@ exit_code: 0
----- stdout -----
🔄 Committing tracked changes with default message... (1 file, +1, -1)
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
-  Changes to tracked.txt
✅ Committed changes @ [SHA]
----- stderr -----
+  Changes to tracked.txt
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap
index 7b308a940..580d48bf2 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_both_flags.snap
@@ -17,7 +17,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "squash: combined commits"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -30,11 +31,11 @@ exit_code: 0
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: add file 1
  - feat: add file 2
-✅ Squashed @ [SHA]
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap
index 87b9d2416..c5ce27399 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_no_verify.snap
@@ -16,7 +16,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "squash: combined commits"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -28,11 +29,11 @@ exit_code: 0
🔄 Squashing 2 commits into a single commit (3 files, +3)...
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: add file 1
  - feat: add file 2
-✅ Squashed @ [SHA]
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap
index 4d62f4ed9..4504a08ac 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_stage_tracked.snap
@@ -16,7 +16,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_COMMIT_GENERATION__ARGS: "squash: combined commits"
WORKTRUNK_COMMIT_GENERATION__COMMAND: echo
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -28,11 +29,11 @@ exit_code: 0
💡 Backup created @ [SHA]
🔄 Generating squash commit message...
💡 Using fallback commit message. Run 'wt config --help' for LLM setup guide
+✅ Squashed @ [SHA]
+
+----- stderr -----
  Squash commits from main
 
  Combined commits:
  - feat: add file 1
  - feat: add file 2
-✅ Squashed @ [SHA]
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
index 6dd9f0957..a5ca7415e 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__both_create_and_start.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,11 +25,10 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'Setup done' > setup.txt
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start server:
-  sleep 0.05 && echo 'Server running' > server.txt
----- stderr -----
-
+  echo 'Setup done' > setup.txt
+  sleep 0.05 && echo 'Server running' > server.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
index 4b7a414bf..89218bb42 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__execute_with_post_start.snap
@@ -19,7 +19,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -28,8 +28,8 @@ exit_code: 0
----- stdout -----
✅ Created new worktree for feature from main at [REPO].feature
🔄 Running post-start:
-  echo 'Background task' > background.txt
🔄 Executing (--execute):
-  echo 'Execute flag' > execute.txt
----- stderr -----
+  echo 'Background task' > background.txt
+  echo 'Execute flag' > execute.txt
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 81df5e2e5..56e530504 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,18 +17,18 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
+
+----- stderr -----
❌ Failed to load project config
  Failed to parse TOML: TOML parse error at line 1, column 31
  |
  1 | post-create = [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 68c19458a..92a95b5e3 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,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,10 +25,10 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  exit 1
🟡 Command failed: exit status: 1
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  exit 1

diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
index 373de87c7..27609b84f 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiline_control_structure.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,13 +25,13 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
+✅ Created new worktree for feature from main at [REPO].feature
+💡 Run `wt config shell install` to enable automatic cd
+
+----- stderr -----
  if [ ! -f test.txt ]; then
  echo 'File does not exist' > result.txt
  else
  echo 'File exists' > result.txt
  fi
-✅ Created new worktree for feature from main at [REPO].feature
-💡 Run `wt config shell install` to enable automatic cd
-
------ stderr -----

diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
index a747877a5..e1d356234 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_multiple_commands_array.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,12 +25,12 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'First'
🔄 Running post-create:
-  echo 'Second'
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  echo 'First'
First
+  echo 'Second'
Second
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
index 3077e2fc1..865499dc3 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_named_commands.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,12 +25,12 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create install:
-  echo 'Installing deps'
🔄 Running post-create setup:
-  echo 'Running setup'
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  echo 'Installing deps'
Installing deps
+  echo 'Running setup'
Running setup
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
index 79b6fe125..9c54034ae 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_single_command.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,9 +25,9 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'Setup complete'
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
+  echo 'Setup complete'
Setup complete
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
index 5e6f12492..4bacde493 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_create_template_expansion.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -25,15 +25,15 @@ success: true
exit_code: 0
----- stdout -----
🔄 Running post-create:
-  echo 'Repo: repo' > info.txt
🔄 Running post-create:
-  echo 'Branch: feature-test' >> info.txt
🔄 Running post-create:
-  echo 'Worktree: [REPO].feature-test' >> info.txt
🔄 Running post-create:
-  echo 'Root: [REPO]' >> info.txt
✅ Created new worktree for feature/test from main at [REPO].feature-test
💡 Run `wt config shell install` to enable automatic cd
----- stderr -----
-
+  echo 'Repo: repo' > info.txt
+  echo 'Branch: feature-test' >> info.txt
+  echo 'Worktree: [REPO].feature-test' >> info.txt
+  echo 'Root: [REPO]' >> info.txt
+
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
index 642d8abce..60aa063b3 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_complex_shell.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,8 +27,8 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start:
+
+----- stderr -----
  echo 'line1
  line2
  line3' | grep line2 > filtered.txt
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
index c035106cc..33e40fed1 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_create_with_command.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,6 +27,6 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start:
-  echo 'POST-START-RAN' > post_start_marker.txt
----- stderr -----
+  echo 'POST-START-RAN' > post_start_marker.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
index 0832a5f83..847a3dda3 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_invalid_command.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,6 +27,6 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start:
-  echo 'unclosed quote
----- stderr -----
+  echo 'unclosed quote
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
index 8329c3ee5..ce558b57c 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_log_captures_output.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,6 +27,6 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start:
-  echo 'stdout output' && echo 'stderr output' >&2
----- stderr -----
+  echo 'stdout output' && echo 'stderr output' >&2
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
index 1589d8b07..b2ca9dc73 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiline_with_newlines.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,8 +27,8 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start:
+
+----- stderr -----
  echo 'first line' > multiline.txt
  echo 'second line' >> multiline.txt
  echo 'third line' >> multiline.txt
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
index caf9382ca..6a3e6faa0 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_multiple_background.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,8 +27,8 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start task1:
-  echo 'Task 1 running' > task1.txt
🔄 Running post-start task2:
-  echo 'Task 2 running' > task2.txt
----- stderr -----
+  echo 'Task 1 running' > task1.txt
+  echo 'Task 2 running' > task2.txt
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
index 9f07e3433..f19214e14 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_separate_logs.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,10 +27,10 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start task1:
-  echo 'TASK1_OUTPUT'
🔄 Running post-start task2:
-  echo 'TASK2_OUTPUT'
🔄 Running post-start task3:
-  echo 'TASK3_OUTPUT'
----- stderr -----
+  echo 'TASK1_OUTPUT'
+  echo 'TASK2_OUTPUT'
+  echo 'TASK3_OUTPUT'
diff --git a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
index f21dd84b9..51c25e824 100644
--- a/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
+++ b/tests/snapshots/integration__integration_tests__post_start_commands__post_start_single_background.snap
@@ -17,7 +17,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,6 +27,6 @@ exit_code: 0
✅ Created new worktree for feature from main at [REPO].feature
💡 Run `wt config shell install` to enable automatic cd
🔄 Running post-start:
-  sleep 0.1 && echo 'Background task done' > background.txt
----- stderr -----
+  sleep 0.1 && echo 'Background task done' > background.txt
diff --git a/tests/snapshots/integration__integration_tests__push__push_dirty_target_autostash.snap b/tests/snapshots/integration__integration_tests__push__push_dirty_target_autostash.snap
index a8eda5eca..6f27f6889 100644
--- a/tests/snapshots/integration__integration_tests__push__push_dirty_target_autostash.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_dirty_target_autostash.snap
@@ -16,7 +16,8 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
@@ -24,10 +25,10 @@ exit_code: 0
----- stdout -----
🔄 Stashing changes in [REPO]...
🔄 Pushing 1 commit to main @ [SHA]
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
🔄 Restoring stashed changes in [REPO]...
✅ Pushed to main (1 commit, 1 file, +1)
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
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 46dfe315f..8bfdc6cf3 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
@@ -16,16 +16,17 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
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 70aa42b8e..ae8fcb24f 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
@@ -16,16 +16,16 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
+
+----- stderr -----
❌ Can't push to local main branch: it has newer commits
  * [SHA] Main commit
💡 Use 'wt step rebase' or 'wt merge' to rebase 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 3cacc93a3..05f22d18e 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
@@ -16,14 +16,15 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
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__push__push_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
index 3da685fa6..e943f8a66 100644
--- a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
@@ -16,16 +16,17 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Pushing 1 commit to main @ [SHA]
-  * [SHA] Add test file
-  test.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Pushed to main (1 commit, 1 file, +1)
----- stderr -----
+  * [SHA] Add test file
+  test.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__push__push_no_remote.snap b/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
index ba56952f1..f86400927 100644
--- a/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
@@ -15,16 +15,17 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Pushing 1 commit to main @ [SHA]
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Pushed to main (1 commit, 1 file, +1)
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
index 1c3a50c1e..059163a91 100644
--- a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
@@ -16,16 +16,17 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Pushing 1 commit to main @ [SHA]
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Pushed to main (1 commit, 1 file, +1)
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__push__push_to_default.snap b/tests/snapshots/integration__integration_tests__push__push_to_default.snap
index ba56952f1..f86400927 100644
--- a/tests/snapshots/integration__integration_tests__push__push_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_to_default.snap
@@ -15,16 +15,17 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Pushing 1 commit to main @ [SHA]
-  * [SHA] Add feature file
-  feature.txt | 1 +
-  1 file changed, 1 insertion(+)
✅ Pushed to main (1 commit, 1 file, +1)
----- stderr -----
+  * [SHA] Add feature file
+  feature.txt | 1 +
+  1 file changed, 1 insertion(+)
diff --git a/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap b/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap
index dcc8bc512..7b4cdb9a2 100644
--- a/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_with_merge_commits_allowed.snap
@@ -17,13 +17,17 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: true
exit_code: 0
----- stdout -----
🔄 Pushing 3 commits to main @ [SHA] (merge commits allowed)
+✅ Pushed to main (3 commits, 2 files, +2)
+
+----- stderr -----
  * [SHA] Merge temp
  |/
  | * [SHA] Commit 2
@@ -32,6 +36,3 @@ exit_code: 0
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
-✅ Pushed to main (3 commits, 2 files, +2)
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap b/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap
index d0db604a5..2eccdc2cc 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap
@@ -15,7 +15,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -24,6 +24,6 @@ exit_code: 0
----- stdout -----
⚪ No worktree found for branch feature-unmerged
🟡 Could not delete branch feature-unmerged
-  error: the branch 'feature-unmerged' is not fully merged
----- stderr -----
+  error: the branch 'feature-unmerged' is not fully merged
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 6215d97f8..04982ecc4 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
@@ -15,14 +15,15 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
+
+----- stderr -----
❌ Cannot remove worktree: 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 6dbfa7bda..e62325adf 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
@@ -14,14 +14,15 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
+
+----- stderr -----
❌ Cannot remove worktree: 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 166daa8b3..f66f84d2a 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_nonexistent_worktree.snap
@@ -15,12 +15,13 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
success: false
exit_code: 1
----- stdout -----
-❌ No worktree found for branch nonexistent
----- stderr -----
+❌ No worktree found for branch nonexistent
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 11e107c80..9cf45fabb 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
@@ -14,16 +14,18 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
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 50dc5e4da..f9482b5c1 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
@@ -13,16 +13,18 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
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_error_path_occupied.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap
new file mode 100644
index 000000000..15af8da73
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap
@@ -0,0 +1,31 @@
+---
+source: tests/integration_tests/switch.rs
+info:
+ program: wt
+ args:
+ - switch
+ - "--create"
+ - occupied-branch
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+---
+success: false
+exit_code: 1
+----- stdout -----
+
+----- stderr -----
+❌ Cannot create worktree for occupied-branch: target path already exists
+
+💡 Reuse the existing worktree at [REPO]/../repo.occupied-branch or remove it before retrying
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
index fd826da07..5363d0e21 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_creates_file.snap
@@ -19,7 +19,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -28,6 +28,6 @@ exit_code: 0
----- stdout -----
✅ Created new worktree for file-test from main at [REPO].file-test
🔄 Executing (--execute):
-  echo 'test content' > test.txt
----- stderr -----
+  echo 'test content' > test.txt
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
index fcd0bcb5e..7d1113890 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_existing.snap
@@ -18,7 +18,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -27,6 +27,6 @@ exit_code: 0
----- stdout -----
✅ Switched to worktree for existing-exec at [REPO].existing-exec
🔄 Executing (--execute):
-  echo 'existing worktree' > existing.txt
----- stderr -----
+  echo 'existing worktree' > existing.txt
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 f61d03668..f8872a706 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:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -28,6 +28,6 @@ exit_code: 1
----- stdout -----
✅ Created new worktree for fail-test from main at [REPO].fail-test
🔄 Executing (--execute):
-  exit 1
----- stderr -----
+  exit 1
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
index bbac93bae..81db844b7 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_multiline.snap
@@ -19,7 +19,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -28,11 +28,11 @@ exit_code: 0
----- stdout -----
✅ Created new worktree for multiline-test from main at [REPO].multiline-test
🔄 Executing (--execute):
-  echo 'line1'
-  echo 'line2'
-  echo 'line3'
line1
line2
line3
----- stderr -----
+  echo 'line1'
+  echo 'line2'
+  echo 'line3'
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
index 0c6d25aaa..f3af2a7a4 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_execute_success.snap
@@ -19,7 +19,7 @@ info:
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
@@ -28,7 +28,7 @@ exit_code: 0
----- stdout -----
✅ Created new worktree for exec-test from main at [REPO].exec-test
🔄 Executing (--execute):
-  echo 'test output'
test output
----- stderr -----
+  echo 'test output'
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 c29a6fac7..6f8bd9c24 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
@@ -13,14 +13,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
- SOURCE_DATE_EPOCH: "1761609600"
+ SOURCE_DATE_EPOCH: "1735776000"
+ WORKTRUNK_BIN: ""
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
---
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.