Skip to content

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

Improve error messages with actionable commands and hints

Maximilian Roos930c5842acaf
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 0087245c0..1c99391bb 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -595,6 +595,7 @@ pub fn handle_switch(
.with_context(|| format!("Failed to move {path_display} to {backup_display}"))?;
} else {
return Err(GitError::WorktreePathExists {
+ branch: resolved_branch.clone(),
path: worktree_path,
}
.into());
@@ -642,6 +643,7 @@ pub fn handle_switch(
})
{
return Err(GitError::WorktreePathExists {
+ branch: resolved_branch.clone(),
path: std::path::PathBuf::from(path_str),
}
.into());
diff --git a/src/git/error.rs b/src/git/error.rs
index 1a12d9c1a..5eb520641 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -9,9 +9,11 @@
//! - **`WorktrunkError`** - A minimal enum for semantic errors that need
//! special handling (exit codes, silent errors).
+use std::borrow::Cow;
use std::path::PathBuf;
use color_print::{cformat, cwrite};
+use shell_escape::escape;
use super::HookType;
use crate::path::format_path_for_display;
@@ -72,6 +74,7 @@ pub enum GitError {
occupant: Option<String>,
},
WorktreePathExists {
+ branch: String,
path: PathBuf,
},
WorktreeCreationFailed {
@@ -146,7 +149,7 @@ impl std::fmt::Display for GitError {
"{}\n\n{}",
error_message(&message),
hint_message(cformat!(
- "Switch to a branch first with <bright-black>git switch <<branch>></>"
+ "To switch to a branch, run <bright-black>git switch <<branch>></>"
))
)
}
@@ -173,12 +176,13 @@ impl std::fmt::Display for GitError {
}
GitError::BranchAlreadyExists { branch } => {
+ let switch_cmd = suggest_command("switch", &[branch], &[]);
write!(
f,
"{}\n\n{}",
error_message(cformat!("Branch <bold>{branch}</> already exists")),
hint_message(cformat!(
- "Remove <bright-black>--create</> flag to switch to the existing branch"
+ "To switch to the existing branch, remove <bright-black>--create</>; run <bright-black>{switch_cmd}</>"
))
)
}
@@ -236,11 +240,10 @@ impl std::fmt::Display for GitError {
} else {
cformat!("existing worktree at <bold>{path_display}</>, detached")
};
- // Hint is self-contained (includes both path and branch)
- let hint = hint_message(cformat!(
- "Switch the worktree at <bright-black>{path_display}</> to <bright-black>{branch}</>"
- ));
- let command = format!("cd {path_display} && git switch {branch}");
+ // Hint leads into the command in the gutter block
+ let hint = hint_message("To switch the worktree to this branch:");
+ let path_escaped = escape(Cow::Borrowed(path_display.as_ref()));
+ let command = format!("cd {path_escaped} && git switch {branch}");
write!(
f,
"{}\n\n{}\n{}",
@@ -252,8 +255,11 @@ impl std::fmt::Display for GitError {
)
}
- GitError::WorktreePathExists { path } => {
+ GitError::WorktreePathExists { branch, path } => {
let path_display = format_path_for_display(path);
+ let path_str = path.to_string_lossy();
+ let path_escaped = escape(Cow::Borrowed(path_str.as_ref()));
+ let switch_cmd = suggest_command("switch", &[branch], &["--clobber"]);
write!(
f,
"{}\n\n{}",
@@ -261,7 +267,7 @@ impl std::fmt::Display for GitError {
"Directory already exists: <bold>{path_display}</>"
)),
hint_message(cformat!(
- "Use <bright-black>--clobber</> to remove, or <bright-black>rm -rf {path_display}</>"
+ "To remove manually, run <bright-black>rm -rf {path_escaped}</>; to retry with backup, run <bright-black>{switch_cmd}</>"
))
)
}
@@ -362,12 +368,13 @@ impl std::fmt::Display for GitError {
}
GitError::MergeCommitsFound => {
+ let merge_cmd = suggest_command("merge", &[], &["--allow-merge-commits"]);
write!(
f,
"{}\n\n{}",
error_message("Found merge commits in push range"),
hint_message(cformat!(
- "To push non-linear history, add <bright-black>--allow-merge-commits</>"
+ "To push non-linear history, run <bright-black>{merge_cmd}</>"
))
)
}
@@ -388,10 +395,10 @@ impl std::fmt::Display for GitError {
f,
"\n\n{}\n{}",
hint_message(cformat!(
- "Resolve conflicts and run <bright-black>git rebase --continue</>"
+ "To continue after resolving conflicts, run <bright-black>git rebase --continue</>"
)),
hint_message(cformat!(
- "Or abort with <bright-black>git rebase --abort</>"
+ "To abort, run <bright-black>git rebase --abort</>"
))
)
}
@@ -415,12 +422,13 @@ impl std::fmt::Display for GitError {
}
GitError::NotInteractive => {
+ let approvals_cmd = suggest_command("hook", &["approvals", "add"], &[]);
write!(
f,
"{}\n\n{}",
error_message("Cannot prompt for approval in non-interactive environment"),
hint_message(cformat!(
- "In CI/CD, use <bright-black>--force</> to skip prompts. To pre-approve commands, use <bright-black>wt hook approvals add</>"
+ "To skip prompts in CI/CD, add <bright-black>--force</>; to pre-approve commands, run <bright-black>{approvals_cmd}</>"
))
)
}
@@ -616,12 +624,12 @@ impl std::fmt::Display for HookErrorWithHint {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// Display the original error (always HookCommandFailed - validated by add_hook_skip_hint)
write!(f, "{}", self.inner)?;
- // Add the hint
+ // Can't derive command from hook type (e.g., PreRemove is used by both `wt remove` and `wt merge`)
write!(
f,
"\n\n{}",
hint_message(cformat!(
- "To skip {} commands, add <bright-black>--no-verify</>",
+ "To skip {} hooks, re-run with <bright-black>--no-verify</>",
self.hook_type
))
)
@@ -656,7 +664,7 @@ mod tests {
assert_snapshot!(err.to_string(), @r"
❌ Not on a branch (detached HEAD)
- πŸ’‘ Switch to a branch first with git switch <branch>
+ πŸ’‘ To switch to a branch, run git switch <branch>
");
}
@@ -685,7 +693,7 @@ mod tests {
assert_snapshot!(downcast.to_string(), @r"
❌ Branch main already exists
- πŸ’‘ Remove --create flag to switch to the existing branch
+ πŸ’‘ To switch to the existing branch, remove --create; run wt switch main
");
}
@@ -706,12 +714,13 @@ mod tests {
#[test]
fn snapshot_worktree_error_with_path() {
let err = GitError::WorktreePathExists {
+ branch: "feature".to_string(),
path: PathBuf::from("/some/path"),
};
assert_snapshot!(err.to_string(), @r"
❌ Directory already exists: /some/path
- πŸ’‘ Use --clobber to remove, or rm -rf /some/path
+ πŸ’‘ To remove manually, run rm -rf /some/path; to retry with backup, run wt switch feature --clobber
");
}
diff --git a/tests/integration_tests/git_error_display.rs b/tests/integration_tests/git_error_display.rs
index bd9522780..5087c942e 100644
--- a/tests/integration_tests/git_error_display.rs
+++ b/tests/integration_tests/git_error_display.rs
@@ -60,6 +60,7 @@ fn display_worktree_path_occupied() {
#[test]
fn display_worktree_path_exists() {
let err = GitError::WorktreePathExists {
+ branch: "feature".to_string(),
path: PathBuf::from("/tmp/repo.feature"),
};
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__branch_already_exists.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__branch_already_exists.snap
index f069453d3..3ae09d859 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__branch_already_exists.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__branch_already_exists.snap
@@ -1,7 +1,7 @@
---
-source: tests/git_error_display.rs
+source: tests/integration_tests/git_error_display.rs
expression: err.to_string()
---
❌ Branch feature already exists
-πŸ’‘ Remove --create flag to switch to the existing branch
+πŸ’‘ To switch to the existing branch, remove --create; run wt switch feature
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head.snap
index 8afaf2147..f0f5d123d 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head.snap
@@ -1,7 +1,7 @@
---
-source: tests/git_error_display.rs
+source: tests/integration_tests/git_error_display.rs
expression: err.to_string()
---
❌ Cannot merge: not on a branch (detached HEAD)
-πŸ’‘ Switch to a branch first with git switch <branch>
+πŸ’‘ To switch to a branch, run git switch <branch>
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head_no_action.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head_no_action.snap
index 70cf6083a..4461907c8 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head_no_action.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__detached_head_no_action.snap
@@ -1,7 +1,7 @@
---
-source: tests/git_error_display.rs
+source: tests/integration_tests/git_error_display.rs
expression: err.to_string()
---
❌ Not on a branch (detached HEAD)
-πŸ’‘ Switch to a branch first with git switch <branch>
+πŸ’‘ To switch to a branch, run git switch <branch>
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__hook_command_failed_with_skip_hint.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__hook_command_failed_with_skip_hint.snap
index 2fe09f073..ea39d9b91 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__hook_command_failed_with_skip_hint.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__hook_command_failed_with_skip_hint.snap
@@ -4,4 +4,4 @@ expression: err_with_hint.to_string()
---
❌ pre-merge command failed: test: exit code 1
-πŸ’‘ To skip pre-merge commands, add --no-verify
+πŸ’‘ To skip pre-merge hooks, re-run with --no-verify
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__merge_commits_found.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__merge_commits_found.snap
index 881b05c29..60e883446 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__merge_commits_found.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__merge_commits_found.snap
@@ -4,4 +4,4 @@ expression: err.to_string()
---
❌ Found merge commits in push range
-πŸ’‘ To push non-linear history, add --allow-merge-commits
+πŸ’‘ To push non-linear history, run wt merge --allow-merge-commits
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__not_interactive.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__not_interactive.snap
index bb1b8ca98..086a258c4 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__not_interactive.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__not_interactive.snap
@@ -1,7 +1,7 @@
---
-source: tests/git_error_display.rs
+source: tests/integration_tests/git_error_display.rs
expression: err.to_string()
---
❌ Cannot prompt for approval in non-interactive environment
-πŸ’‘ In CI/CD, use --force to skip prompts. To pre-approve commands, use wt hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook approvals add
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap
index 5a7d91f44..723fbcc1e 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_exists.snap
@@ -4,4 +4,4 @@ expression: err.to_string()
---
❌ Directory already exists: /tmp/repo.feature
-πŸ’‘ Use --clobber to remove, or rm -rf /tmp/repo.feature
+πŸ’‘ To remove manually, run rm -rf /tmp/repo.feature; to retry with backup, run wt switch feature --clobber
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap
index ccd385f63..ccb07908e 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__worktree_path_occupied.snap
@@ -4,5 +4,5 @@ expression: err.to_string()
---
❌ Cannot create worktree for feature-z: existing worktree at /tmp/repo.feature-z on other-branch
-πŸ’‘ Switch the worktree at /tmp/repo.feature-z to feature-z
+πŸ’‘ To switch the worktree to this branch:
  cd /tmp/repo.feature-z && git switch feature-z
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap
index 50662d332..04f9be73a 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__command_failure.snap
@@ -4,4 +4,4 @@ expression: output.normalized()
---
❌ Branch existing already exists
-πŸ’‘ Remove --create flag to switch to the existing branch
+πŸ’‘ To switch to the existing branch, remove --create; run wt switch existing
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
index 250afddf6..65ff0330f 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_bash.snap
@@ -10,4 +10,4 @@ expression: output.normalized()
βœ— Test suite failed: 3 tests failing
❌ pre-merge command failed: test: exit status: 1
-πŸ’‘ To skip pre-merge commands, add --no-verify
+πŸ’‘ To skip pre-merge hooks, re-run with --no-verify
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
index 250afddf6..65ff0330f 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_failure_zsh.snap
@@ -10,4 +10,4 @@ expression: output.normalized()
βœ— Test suite failed: 3 tests failing
❌ pre-merge command failed: test: exit status: 1
-πŸ’‘ To skip pre-merge commands, add --no-verify
+πŸ’‘ To skip pre-merge hooks, re-run with --no-verify
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 db9cee6a5..a84c61bd1 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
@@ -7,6 +7,7 @@ info:
- "--create"
- test-non-tty
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -14,10 +15,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
exit_code: 1
@@ -30,4 +37,4 @@ exit_code: 1
  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 hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 c0098a114..1627b4f42 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
@@ -14,4 +14,4 @@ exit_code: 1
  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 hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 914562faf..894043ba1 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
@@ -18,4 +18,4 @@ exit_code: 1
  cd {{ worktree }} && pwd
❌ Cannot prompt for approval in non-interactive environment
-πŸ’‘ In CI/CD, use --force to skip prompts. To pre-approve commands, use wt hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 7bdd45031..8541cd0d5 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
@@ -16,4 +16,4 @@ exit_code: 1
  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 hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 cca23b423..4e971f749 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
@@ -12,4 +12,4 @@ exit_code: 1
  echo 'Worktree path: {{ worktree }}'
❌ Cannot prompt for approval in non-interactive environment
-πŸ’‘ In CI/CD, use --force to skip prompts. To pre-approve commands, use wt hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 c0098a114..1627b4f42 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
@@ -14,4 +14,4 @@ exit_code: 1
  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 hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook approvals add
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 17b1d3bbf..876e4f549 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
@@ -12,4 +12,4 @@ exit_code: 1
  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 hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 d2c963836..ab97ded6e 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
@@ -12,4 +12,4 @@ exit_code: 1
  echo 'Post-merge cleanup for {{ branch }}'
❌ Cannot prompt for approval in non-interactive environment
-πŸ’‘ In CI/CD, use --force to skip prompts. To pre-approve commands, use wt hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 b18572282..0c3177551 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
@@ -12,4 +12,4 @@ exit_code: 1
  echo 'Running pre-merge checks on {{ branch }}'
❌ Cannot prompt for approval in non-interactive environment
-πŸ’‘ In CI/CD, use --force to skip prompts. To pre-approve commands, use wt hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook 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 a9e9816a3..92f1c4655 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
@@ -8,6 +8,7 @@ info:
- add
- "--all"
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -15,10 +16,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
exit_code: 1
@@ -31,4 +38,4 @@ exit_code: 1
  echo 'test'
❌ Cannot prompt for approval in non-interactive environment
-πŸ’‘ In CI/CD, use --force to skip prompts. To pre-approve commands, use wt hook approvals add
+πŸ’‘ To skip prompts in CI/CD, add --force; to pre-approve commands, run wt hook approvals add
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 7008267ba..a492d52db 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
@@ -6,6 +6,7 @@ info:
- merge
- main
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -13,10 +14,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
exit_code: 1
@@ -25,4 +32,4 @@ exit_code: 1
----- stderr -----
❌ Cannot merge: not on a branch (detached HEAD)
-πŸ’‘ Switch to a branch first with git switch <branch>
+πŸ’‘ To switch to a branch, run git switch <branch>
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 ab1a0c83d..b8a2e4455 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
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -41,4 +42,4 @@ exit_code: 1
🟑 Command failed: exit status: 1
❌ post-merge command failed: exit status: 1
-πŸ’‘ To skip post-merge commands, add --no-verify
+πŸ’‘ To skip post-merge hooks, re-run with --no-verify
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 f90545eea..721ed8e8d 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
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -36,4 +37,4 @@ exit_code: 1
  exit 1
❌ pre-commit command failed: exit status: 1
-πŸ’‘ To skip pre-commit commands, add --no-verify
+πŸ’‘ To skip pre-commit hooks, re-run with --no-verify
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 c3b29d00b..a9bc26161 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
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -34,4 +35,4 @@ exit_code: 1
  exit 1
❌ pre-merge command failed: exit status: 1
-πŸ’‘ To skip pre-merge commands, add --no-verify
+πŸ’‘ To skip pre-merge hooks, re-run with --no-verify
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 a557aa3e5..d8b4e3a8a 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
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -34,4 +35,4 @@ exit_code: 1
  exit 1
❌ pre-commit command failed: exit status: 1
-πŸ’‘ To skip pre-commit commands, add --no-verify
+πŸ’‘ To skip pre-commit hooks, re-run with --no-verify
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 7b53ff818..29f47a913 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
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -32,4 +33,4 @@ exit_code: 1
----- stderr -----
❌ Found merge commits in push range
-πŸ’‘ To push non-linear history, add --allow-merge-commits
+πŸ’‘ To push non-linear history, run wt merge --allow-merge-commits
diff --git a/tests/snapshots/integration__integration_tests__remove__pre_remove_hook_failure_aborts.snap b/tests/snapshots/integration__integration_tests__remove__pre_remove_hook_failure_aborts.snap
index aef3f2903..42ab57819 100644
--- a/tests/snapshots/integration__integration_tests__remove__pre_remove_hook_failure_aborts.snap
+++ b/tests/snapshots/integration__integration_tests__remove__pre_remove_hook_failure_aborts.snap
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -35,4 +36,4 @@ exit_code: 1
  exit 1
❌ pre-remove command failed: exit status: 1
-πŸ’‘ To skip pre-remove commands, add --no-verify
+πŸ’‘ To skip pre-remove hooks, re-run with --no-verify
diff --git a/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap b/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap
index 9b7ff87f4..1e44c94ab 100644
--- a/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap
+++ b/tests/snapshots/integration__integration_tests__security__branch_name_with_cd_directive_not_executed.snap
@@ -8,6 +8,7 @@ info:
- "--create"
- __WORKTRUNK_CD__/tmp
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -15,10 +16,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
exit_code: 1
@@ -27,4 +34,4 @@ exit_code: 1
----- stderr -----
❌ Branch __WORKTRUNK_CD__/tmp already exists
-πŸ’‘ Remove --create flag to switch to the existing branch
+πŸ’‘ To switch to the existing branch, remove --create; run wt switch __WORKTRUNK_CD__/tmp
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 c1db5dcaf..41bec5ee6 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
@@ -7,6 +7,7 @@ info:
- "--create"
- feature-y
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -14,12 +15,16 @@ info:
GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
GIT_CONFIG_SYSTEM: /dev/null
GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
HOME: "[TEST_HOME]"
LANG: C
LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
exit_code: 1
@@ -28,4 +33,4 @@ exit_code: 1
----- stderr -----
❌ Branch feature-y already exists
-πŸ’‘ Remove --create flag to switch to the existing branch
+πŸ’‘ To switch to the existing branch, remove --create; run wt switch feature-y
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap
index 59f569694..3cf71ce9c 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_main_worktree_on_different_branch.snap
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -32,5 +33,5 @@ exit_code: 1
----- stderr -----
❌ Cannot create worktree for main: existing worktree at [REPO] on feature
-πŸ’‘ Switch the worktree at [REPO] to main
+πŸ’‘ To switch the worktree to this branch:
  cd [REPO] && git switch main
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
index 751e79889..4f0135481 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied.snap
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -32,4 +33,4 @@ exit_code: 1
----- stderr -----
❌ Directory already exists: [REPO].occupied-branch
-πŸ’‘ Use --clobber to remove, or rm -rf [REPO].occupied-branch
+πŸ’‘ To remove manually, run rm -rf [REPO].occupied-branch; to retry with backup, run wt switch occupied-branch --clobber
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap
index 084993507..0916a28d5 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_detached.snap
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -32,5 +33,5 @@ exit_code: 1
----- stderr -----
❌ Cannot create worktree for feature: existing worktree at [REPO].feature, detached
-πŸ’‘ Switch the worktree at [REPO].feature to feature
+πŸ’‘ To switch the worktree to this branch:
  cd [REPO].feature && git switch feature
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap
index e6bafbcce..75132c545 100644
--- a/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap
+++ b/tests/snapshots/integration__integration_tests__switch__switch_error_path_occupied_different_branch.snap
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -32,5 +33,5 @@ exit_code: 1
----- stderr -----
❌ Cannot create worktree for feature: existing worktree at [REPO].feature on bugfix
-πŸ’‘ Switch the worktree at [REPO].feature to feature
+πŸ’‘ To switch the worktree to this branch:
  cd [REPO].feature && git switch feature
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_failure.snap
index b1b50f581..53fae67bd 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_failure.snap
@@ -21,6 +21,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -37,4 +38,4 @@ exit_code: 1
  exit 1
❌ pre-commit command failed: lint: exit status: 1
-πŸ’‘ To skip pre-commit commands, add --no-verify
+πŸ’‘ To skip pre-commit hooks, re-run with --no-verify
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_failure.snap
index 04487b799..39d4e1f49 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_failure.snap
@@ -21,6 +21,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -35,4 +36,4 @@ exit_code: 1
  exit 1
❌ pre-merge command failed: check: exit status: 1
-πŸ’‘ To skip pre-merge commands, add --no-verify
+πŸ’‘ To skip pre-merge hooks, re-run with --no-verify
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_failure.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_failure.snap
index 22023b40b..a4bef58d0 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_failure.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_remove_failure.snap
@@ -20,6 +20,7 @@ info:
LANG: C
LC_ALL: C
PATH: "[PATH]"
+ RUST_LOG: warn
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
@@ -34,4 +35,4 @@ exit_code: 1
  exit 1
❌ pre-remove command failed: block: exit status: 1
-πŸ’‘ To skip pre-remove commands, add --no-verify
+πŸ’‘ To skip pre-remove hooks, re-run with --no-verify