Skip to content

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

Enable Windows test support with cross-platform mock infrastructure (#401)

Maximilian Roose8f10377199e
diff --git a/Cargo.lock b/Cargo.lock
index abbc44fcc..663b18bea 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1402,6 +1402,10 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "mock-stub"
+version = "0.1.0"
+
[[package]]
name = "nix"
version = "0.28.0"
diff --git a/Cargo.toml b/Cargo.toml
index a415db075..988a399b8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[workspace]
-members = ["tests/helpers/setup-select-test", "tests/helpers/dev-detach"]
-# Include dev-detach so `cargo test` builds its binary (via its integration test)
-default-members = [".", "tests/helpers/dev-detach"]
+members = ["tests/helpers/setup-select-test", "tests/helpers/dev-detach", "tests/helpers/mock-stub"]
+# Include helpers so `cargo test` builds their binaries (via their integration tests)
+default-members = [".", "tests/helpers/dev-detach", "tests/helpers/mock-stub"]
[package]
name = "worktrunk"
diff --git a/src/commands/list/ci_status.rs b/src/commands/list/ci_status.rs
index ba9ac3cfc..180097d0e 100644
--- a/src/commands/list/ci_status.rs
+++ b/src/commands/list/ci_status.rs
@@ -686,29 +686,20 @@ fn configure_non_interactive(cmd: &mut Command) {
/// Check if a CLI tool is available
///
-/// On Windows, this uses `cmd.exe /c` to properly resolve batch files (.cmd/.bat)
-/// that may be in PATH, since Rust's Command::new doesn't search PATHEXT.
+/// On Windows, CreateProcessW (via Command::new) searches PATH for .exe files.
+/// We provide .exe mocks in tests via mock-stub, so this works consistently.
///
/// Uses `Stdio::null()` for stdin to prevent tools like `gh` from prompting
/// for user input when they detect a TTY.
fn tool_available(tool: &str, args: &[&str]) -> bool {
use std::process::Stdio;
- #[cfg(windows)]
- let mut cmd = {
- let cmd_str = format!("{} {}", tool, args.join(" "));
- let mut c = Command::new("cmd");
- c.args(["/c", &cmd_str]);
- c.stdin(Stdio::null());
- c
- };
- #[cfg(not(windows))]
- let mut cmd = {
- let mut c = Command::new(tool);
- c.args(args);
- c.stdin(Stdio::null());
- c
- };
+ // Use Command::new(tool) directly on all platforms.
+ // On Windows, CreateProcessW searches PATH for .exe files.
+ // This is simpler and more reliable than going through cmd.exe.
+ let mut cmd = Command::new(tool);
+ cmd.args(args);
+ cmd.stdin(Stdio::null());
run(&mut cmd, None)
.map(|o| o.status.success())
diff --git a/tests/common/mock_commands.rs b/tests/common/mock_commands.rs
new file mode 100644
index 000000000..b838a8d3a
--- /dev/null
+++ b/tests/common/mock_commands.rs
@@ -0,0 +1,287 @@
+// Cross-platform mock command helpers
+//
+// These helpers create mock executables that work on both Unix and Windows.
+// All mock logic is written as shell scripts (#!/bin/sh).
+//
+// On Unix: shell scripts are directly executable via shebang
+// On Windows: mock-stub.exe delegates to bash + shell script
+//
+// Requirements:
+// - On Windows, Git Bash must be installed and `bash` must be in PATH
+// - This matches production: hooks require Git Bash on Windows anyway
+//
+// This approach:
+// - Single source of truth for mock behavior
+// - Simpler than maintaining parallel shell/batch implementations
+
+use std::fs;
+use std::path::Path;
+
+/// Path to the mock-stub.exe binary, built by `cargo test`.
+#[cfg(windows)]
+fn mock_stub_exe() -> std::path::PathBuf {
+ // The mock-stub binary is built by cargo test (via its dummy integration test)
+ // and lives in the same target directory as the test binary.
+ let mut path = std::env::current_exe().expect("failed to get test executable path");
+ path.pop(); // Remove test binary name
+ path.pop(); // Remove deps/
+ path.push("mock-stub.exe");
+ path
+}
+
+/// Write a mock shell script, with platform-appropriate setup.
+///
+/// On Unix: writes directly as executable script
+/// On Windows: writes script + copies mock-stub.exe as name.exe
+pub fn write_mock_script(bin_dir: &Path, name: &str, script: &str) {
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ let script_path = bin_dir.join(name);
+ fs::write(&script_path, script).unwrap();
+ fs::set_permissions(&script_path, fs::Permissions::from_mode(0o755)).unwrap();
+ }
+
+ #[cfg(windows)]
+ {
+ // Write the shell script (no extension) - mock-stub.exe will invoke this via bash
+ let script_path = bin_dir.join(name);
+ fs::write(&script_path, script).unwrap();
+
+ // Copy mock-stub.exe as name.exe (for Rust's Command::new which uses CreateProcessW)
+ let exe_path = bin_dir.join(format!("{}.exe", name));
+ fs::copy(mock_stub_exe(), &exe_path)
+ .expect("failed to copy mock-stub.exe - did `cargo test` build it?");
+
+ // Create .bat/.cmd shims for CMD/PowerShell invocations.
+ // Not strictly required for our tests (Command::new finds .exe, Git Bash finds scripts),
+ // but provides a fallback if anyone debugs tests from cmd.exe.
+ let shim = format!("@bash \"%~dp0{}\" %*\n", name);
+ fs::write(bin_dir.join(format!("{}.cmd", name)), &shim).unwrap();
+ fs::write(bin_dir.join(format!("{}.bat", name)), &shim).unwrap();
+ }
+}
+
+/// Create a mock command that outputs fixed lines and exits.
+///
+/// Each line is echoed. Stdin is discarded (for mocks that receive piped input).
+pub fn create_simple_mock(bin_dir: &Path, name: &str, output: &str, exit_code: i32) {
+ let echoes: String = output
+ .lines()
+ .map(|line| format!("echo '{}'\n", escape_shell_string(line)))
+ .collect();
+
+ let script = format!(
+ r#"#!/bin/sh
+cat > /dev/null
+{echoes}exit {exit_code}
+"#
+ );
+
+ write_mock_script(bin_dir, name, &script);
+}
+
+/// Escape single quotes in shell strings.
+fn escape_shell_string(s: &str) -> String {
+ s.replace('\'', "'\"'\"'")
+}
+
+// === High-level mock helpers for common test scenarios ===
+
+/// Create a mock cargo command for tests.
+///
+/// Handles: test, clippy, install subcommands with realistic output.
+pub fn create_mock_cargo(bin_dir: &Path) {
+ write_mock_script(
+ bin_dir,
+ "cargo",
+ r#"#!/bin/sh
+case "$1" in
+ test)
+ echo ' Finished test [unoptimized + debuginfo] target(s) in 0.12s'
+ echo ' Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)'
+ echo ''
+ echo 'running 18 tests'
+ echo 'test auth::tests::test_jwt_decode ... ok'
+ echo 'test auth::tests::test_jwt_encode ... ok'
+ echo 'test auth::tests::test_token_refresh ... ok'
+ echo 'test auth::tests::test_token_validation ... ok'
+ echo ''
+ echo 'test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s'
+ ;;
+ clippy)
+ echo ' Checking worktrunk v0.1.0'
+ echo ' Finished dev [unoptimized + debuginfo] target(s) in 1.23s'
+ ;;
+ install)
+ echo ' Installing worktrunk v0.1.0'
+ echo ' Compiling worktrunk v0.1.0'
+ echo ' Finished release [optimized] target(s) in 2.34s'
+ echo ' Installing ~/.cargo/bin/wt'
+ echo ' Installed package `worktrunk v0.1.0` (executable `wt`)'
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+"#,
+ );
+}
+
+/// Create a mock llm command that outputs a commit message.
+///
+/// The commit message is suitable for JWT authentication feature commits.
+pub fn create_mock_llm_auth(bin_dir: &Path) {
+ create_simple_mock(
+ bin_dir,
+ "llm",
+ r#"feat(auth): Implement JWT authentication system
+
+Add comprehensive JWT token handling including validation, refresh logic,
+and authentication tests. This establishes the foundation for secure
+API authentication.
+
+- Implement token refresh mechanism with expiry handling
+- Add JWT encoding/decoding with signature verification
+- Create test suite covering all authentication flows"#,
+ 0,
+ );
+}
+
+/// Create a mock llm command for API endpoint commits.
+pub fn create_mock_llm_api(bin_dir: &Path) {
+ create_simple_mock(
+ bin_dir,
+ "llm",
+ r#"feat(api): Add user authentication endpoints
+
+Implement login and token refresh endpoints with JWT validation.
+Includes comprehensive test coverage and input validation."#,
+ 0,
+ );
+}
+
+/// Create a mock uv command for dependency sync and dev server.
+///
+/// Handles: `uv sync` (1 arg) and `uv run dev` (2 args).
+pub fn create_mock_uv_sync(bin_dir: &Path) {
+ write_mock_script(
+ bin_dir,
+ "uv",
+ r#"#!/bin/sh
+if [ "$1" = "sync" ]; then
+ echo ''
+ echo ' Resolved 24 packages in 145ms'
+ echo ' Installed 24 packages in 1.2s'
+elif [ "$1" = "run" ] && [ "$2" = "dev" ]; then
+ echo ''
+ echo ' Starting dev server on http://localhost:3000...'
+else
+ echo "uv: unknown command '$1 $2'"
+ exit 1
+fi
+"#,
+ );
+}
+
+/// Create mock uv that delegates to pytest/ruff commands.
+pub fn create_mock_uv_pytest_ruff(bin_dir: &Path) {
+ write_mock_script(
+ bin_dir,
+ "uv",
+ r#"#!/bin/sh
+if [ "$1" = "run" ] && [ "$2" = "pytest" ]; then
+ exec pytest
+elif [ "$1" = "run" ] && [ "$2" = "ruff" ]; then
+ shift 2
+ exec ruff "$@"
+else
+ echo "uv: unknown command '$1 $2'"
+ exit 1
+fi
+"#,
+ );
+}
+
+/// Create a mock pytest command with test output.
+pub fn create_mock_pytest(bin_dir: &Path) {
+ create_simple_mock(
+ bin_dir,
+ "pytest",
+ r#"
+============================= test session starts ==============================
+collected 3 items
+
+tests/test_auth.py::test_login_success PASSED [ 33%]
+tests/test_auth.py::test_login_invalid_password PASSED [ 66%]
+tests/test_auth.py::test_token_validation PASSED [100%]
+
+============================== 3 passed in 0.8s ===============================
+"#,
+ 0,
+ );
+}
+
+/// Create a mock ruff command.
+pub fn create_mock_ruff(bin_dir: &Path) {
+ write_mock_script(
+ bin_dir,
+ "ruff",
+ r#"#!/bin/sh
+case "$1" in
+ check)
+ echo ''
+ echo 'All checks passed!'
+ echo ''
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+"#,
+ );
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use tempfile::TempDir;
+
+ #[test]
+ fn test_write_mock_script() {
+ let temp = TempDir::new().unwrap();
+ let bin_dir = temp.path();
+
+ write_mock_script(bin_dir, "test-cmd", "#!/bin/sh\necho 'hello'\n");
+
+ #[cfg(unix)]
+ assert!(bin_dir.join("test-cmd").exists());
+
+ #[cfg(windows)]
+ {
+ assert!(bin_dir.join("test-cmd").exists());
+ assert!(bin_dir.join("test-cmd.exe").exists());
+ assert!(bin_dir.join("test-cmd.cmd").exists());
+ assert!(bin_dir.join("test-cmd.bat").exists());
+ }
+ }
+
+ #[test]
+ fn test_create_simple_mock() {
+ let temp = TempDir::new().unwrap();
+ let bin_dir = temp.path();
+
+ create_simple_mock(bin_dir, "simple-cmd", "Line 1\nLine 2\nLine 3", 0);
+
+ #[cfg(unix)]
+ assert!(bin_dir.join("simple-cmd").exists());
+
+ #[cfg(windows)]
+ {
+ assert!(bin_dir.join("simple-cmd").exists());
+ assert!(bin_dir.join("simple-cmd.exe").exists());
+ assert!(bin_dir.join("simple-cmd.cmd").exists());
+ assert!(bin_dir.join("simple-cmd.bat").exists());
+ }
+ }
+}
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 4327d462c..1e9e72807 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -46,6 +46,9 @@ pub mod progressive_output;
#[cfg(all(unix, feature = "shell-integration-tests"))]
pub mod shell;
+// Cross-platform mock command helpers
+pub mod mock_commands;
+
/// Block SIGTTIN and SIGTTOU signals to prevent test processes from being
/// stopped when PTY operations interact with terminal control in background
/// process groups.
@@ -1490,13 +1493,15 @@ impl TestRepo {
/// - `glab --version`: succeeds (installed)
/// - `glab auth status`: fails (not authenticated)
pub fn setup_mock_ci_tools_unauthenticated(&mut self) {
+ use crate::common::mock_commands::write_mock_script;
+
let mock_bin = self.temp_dir.path().join("mock-bin");
std::fs::create_dir_all(&mock_bin).unwrap();
// Create mock gh script - installed but not authenticated
- let gh_script = mock_bin.join("gh");
- std::fs::write(
- &gh_script,
+ write_mock_script(
+ &mock_bin,
+ "gh",
r#"#!/bin/sh
# Mock gh: installed but not authenticated
@@ -1514,47 +1519,12 @@ case "$1" in
;;
esac
"#,
- )
- .unwrap();
-
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- std::fs::set_permissions(&gh_script, std::fs::Permissions::from_mode(0o755)).unwrap();
- }
-
- // Create Windows batch file version of gh mock (unauthenticated)
- #[cfg(windows)]
- {
- let gh_cmd = mock_bin.join("gh.cmd");
- // Use goto-based structure for reliable exit codes on Windows.
- // Single-line `if ... exit /b N` can have inconsistent behavior
- // when scripts are invoked via `cmd /c`.
- std::fs::write(
- &gh_cmd,
- r#"@echo off
-if "%1"=="--version" goto version
-if "%1"=="auth" goto auth
-goto fail
-
-:version
-echo gh version 2.0.0 (mock)
-exit /b 0
-
-:auth
-exit /b 1
-
-:fail
-exit /b 1
-"#,
- )
- .unwrap();
- }
+ );
// Create mock glab script - installed but not authenticated
- let glab_script = mock_bin.join("glab");
- std::fs::write(
- &glab_script,
+ write_mock_script(
+ &mock_bin,
+ "glab",
r#"#!/bin/sh
# Mock glab: installed but not authenticated
@@ -1572,40 +1542,7 @@ case "$1" in
;;
esac
"#,
- )
- .unwrap();
-
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- std::fs::set_permissions(&glab_script, std::fs::Permissions::from_mode(0o755)).unwrap();
- }
-
- // Create Windows batch file version of glab mock (unauthenticated)
- #[cfg(windows)]
- {
- let glab_cmd = mock_bin.join("glab.cmd");
- // Use goto-based structure for reliable exit codes on Windows.
- std::fs::write(
- &glab_cmd,
- r#"@echo off
-if "%1"=="--version" goto version
-if "%1"=="auth" goto auth
-goto fail
-
-:version
-echo glab version 1.0.0 (mock)
-exit /b 0
-
-:auth
-exit /b 1
-
-:fail
-exit /b 1
-"#,
- )
- .unwrap();
- }
+ );
self.mock_bin_path = Some(mock_bin);
}
@@ -1619,22 +1556,29 @@ exit /b 1
/// * `pr_json` - JSON string to return for `gh pr list --json ...`
/// * `run_json` - JSON string to return for `gh run list --json ...`
pub fn setup_mock_gh_with_ci_data(&mut self, pr_json: &str, run_json: &str) {
+ use crate::common::mock_commands::write_mock_script;
+
let mock_bin = self.temp_dir.path().join("mock-bin");
std::fs::create_dir_all(&mock_bin).unwrap();
- // Write JSON files to be read by the script
+ // Write JSON to separate files to avoid all escaping issues
let pr_json_file = mock_bin.join("pr_data.json");
let run_json_file = mock_bin.join("run_data.json");
std::fs::write(&pr_json_file, pr_json).unwrap();
std::fs::write(&run_json_file, run_json).unwrap();
- // Create mock gh script that returns JSON data
- let gh_script = mock_bin.join("gh");
- std::fs::write(
- &gh_script,
- format!(
- r#"#!/bin/sh
+ // Use dirname "$0" to find JSON files relative to script.
+ // This works on both Unix and Windows because:
+ // - On Unix: $0 is the script path as invoked
+ // - On Windows: mock-stub.exe converts the path to MSYS2 format before invoking bash
+ write_mock_script(
+ &mock_bin,
+ "gh",
+ r#"#!/bin/sh
# Mock gh command that returns configured JSON data
+# JSON files are in the same directory as this script
+
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
case "$1" in
--version)
@@ -1647,12 +1591,12 @@ case "$1" in
;;
pr)
# gh pr list - return PR data from file
- cat "{pr_json}"
+ cat "$SCRIPT_DIR/pr_data.json"
exit 0
;;
run)
# gh run list - return run data from file
- cat "{run_json}"
+ cat "$SCRIPT_DIR/run_data.json"
exit 0
;;
*)
@@ -1660,75 +1604,17 @@ case "$1" in
;;
esac
"#,
- pr_json = pr_json_file.display(),
- run_json = run_json_file.display(),
- ),
- )
- .unwrap();
-
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- std::fs::set_permissions(&gh_script, std::fs::Permissions::from_mode(0o755)).unwrap();
- }
-
- // Create Windows batch file versions of gh mock (.bat and .cmd)
- // Both are needed because different resolution methods may prefer different extensions.
- // Use %~dp0 (directory containing the batch file) for reliable relative paths.
- #[cfg(windows)]
- {
- let batch_content = r#"@echo off
-if "%1"=="--version" goto version
-if "%1"=="auth" goto auth
-if "%1"=="pr" goto pr
-if "%1"=="run" goto run
-goto fail
-
-:version
-echo gh version 2.0.0 (mock)
-exit /b 0
-
-:auth
-exit /b 0
-
-:pr
-type "%~dp0pr_data.json"
-exit /b 0
-
-:run
-type "%~dp0run_data.json"
-exit /b 0
-
-:fail
-exit /b 1
-"#;
- std::fs::write(mock_bin.join("gh.cmd"), batch_content).unwrap();
- std::fs::write(mock_bin.join("gh.bat"), batch_content).unwrap();
- }
+ );
// Create mock glab script (fails immediately - no GitLab support in this mock)
- let glab_script = mock_bin.join("glab");
- std::fs::write(
- &glab_script,
+ write_mock_script(
+ &mock_bin,
+ "glab",
r#"#!/bin/sh
# Mock glab command that fails fast
exit 1
"#,
- )
- .unwrap();
-
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- std::fs::set_permissions(&glab_script, std::fs::Permissions::from_mode(0o755)).unwrap();
- }
-
- #[cfg(windows)]
- {
- let glab_content = "@echo off\nexit /b 1\n";
- std::fs::write(mock_bin.join("glab.cmd"), glab_content).unwrap();
- std::fs::write(mock_bin.join("glab.bat"), glab_content).unwrap();
- }
+ );
self.mock_bin_path = Some(mock_bin);
}
@@ -1738,37 +1624,30 @@ exit 1
/// Must call `setup_mock_gh()` first. Prepends the mock bin directory to PATH
/// so gh/glab commands are intercepted.
///
- /// On Windows, this also removes directories containing real gh.exe/glab.exe
- /// from PATH and sets PATHEXT to prefer .BAT/.CMD before .EXE. This ensures
- /// our mock .bat/.cmd scripts are found instead of any real gh.exe.
+ /// On Windows, the mock commands have .exe files (via mock-stub) so they're
+ /// found directly by CreateProcessW without needing PATHEXT manipulation.
///
/// Metadata redactions keep PATH private in snapshots, so we can reuse the
/// caller's PATH instead of a hardcoded minimal list.
pub fn configure_mock_commands(&self, cmd: &mut Command) {
if let Some(mock_bin) = &self.mock_bin_path {
- let mut paths: Vec<PathBuf> = std::env::var_os("PATH")
+ // On Windows, env vars are case-insensitive but Rust stores them
+ // case-sensitively. Find the actual PATH variable name to avoid
+ // creating a duplicate with different case.
+ let (path_var_name, current_path) = std::env::vars_os()
+ .find(|(k, _)| k.eq_ignore_ascii_case("PATH"))
+ .map(|(k, v)| (k.to_string_lossy().into_owned(), Some(v)))
+ .unwrap_or(("PATH".to_string(), None));
+
+ let mut paths: Vec<PathBuf> = current_path
.as_deref()
.map(|p| std::env::split_paths(p).collect())
.unwrap_or_default();
- // On Windows, Rust's Command::new looks for executables with .exe extension.
- // We need a gh.exe in mock_bin, but creating real executables is complex.
- // Instead, create a gh.bat (which Windows will execute for "gh" if .bat
- // comes before .exe in PATHEXT) and modify PATHEXT accordingly.
- // Also remove directories containing real gh.exe from PATH.
- #[cfg(windows)]
- {
- paths.retain(|dir| !dir.join("gh.exe").exists() && !dir.join("glab.exe").exists());
- // Put .BAT before .EXE so our gh.bat is found
- cmd.env(
- "PATHEXT",
- ".BAT;.CMD;.COM;.EXE;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC",
- );
- }
-
+ // Prepend mock bin to PATH so our mocks are found first
paths.insert(0, mock_bin.clone());
let new_path = std::env::join_paths(&paths).unwrap();
- cmd.env("PATH", new_path);
+ cmd.env(&path_var_name, new_path);
}
}
@@ -2182,6 +2061,28 @@ fn setup_snapshot_settings_for_paths(
"\x1b[2m $1 \x1b[0m\x1b[2m",
);
+ // Normalize commit hashes throughout output.
+ // Git on Windows produces different tree hashes due to filemode handling, causing
+ // commit hashes to differ between platforms. Redact to [HASH] for consistency.
+ //
+ // Pattern 1: "Squashed @ <hash>" and "Committed @ <hash>" messages
+ // Format: "Squashed @ " + optional dim code + 7-char hex hash + optional reset
+ settings.add_filter(
+ r"(Squashed|Committed) @ (?:\x1b\[2m)?[a-f0-9]{7}(?:\x1b\[22m)?",
+ "$1 @ [HASH]",
+ );
+ // Pattern 2: "Merging/Pushing N commit(s) to branch @ <hash>" messages
+ // Format: "@ " + dim code + 7-char hex hash + reset
+ settings.add_filter(r"@ \x1b\[2m[a-f0-9]{7}\x1b\[22m", "@ \x1b[2m[HASH]\x1b[22m");
+ // Pattern 3: Git log style "* <hash> message" lines
+ // Format: "* " + yellow code + 7-char hex hash + reset
+ settings.add_filter(r"\* \x1b\[33m[a-f0-9]{7}\x1b\[m", "* \x1b[33m[HASH]\x1b[m");
+
+ // Filter out CARGO_LLVM_COV env variables from snapshot YAML headers.
+ // These are only present during coverage runs and cause snapshot mismatches.
+ settings.add_filter(r#" CARGO_LLVM_COV: "1"\n"#, "");
+ settings.add_filter(r#" CARGO_LLVM_COV_TARGET_DIR: "[^"]+"\n"#, "");
+
settings
}
diff --git a/tests/helpers/mock-stub/Cargo.toml b/tests/helpers/mock-stub/Cargo.toml
new file mode 100644
index 000000000..472b41c24
--- /dev/null
+++ b/tests/helpers/mock-stub/Cargo.toml
@@ -0,0 +1,21 @@
+# Windows-compatible mock executable stub for integration tests.
+#
+# On Windows, Rust's Command::new() uses CreateProcessW which only finds .exe files.
+# This stub executable delegates to bash with a companion shell script:
+# gh.exe + gh (script) -> gh.exe runs: bash gh <args>
+#
+# WHY A SEPARATE PACKAGE?
+# See dev-detach/Cargo.toml for explanation of cargo-dist compatibility.
+#
+# HOW THE BINARY GETS BUILT:
+# Has a dummy integration test (tests/builds.rs) that triggers binary compilation
+# when running `cargo test`. See dev-detach for details.
+[package]
+name = "mock-stub"
+version = "0.1.0"
+edition = "2024"
+publish = false
+
+[[bin]]
+name = "mock-stub"
+path = "src/main.rs"
diff --git a/tests/helpers/mock-stub/src/main.rs b/tests/helpers/mock-stub/src/main.rs
new file mode 100644
index 000000000..0c2502412
--- /dev/null
+++ b/tests/helpers/mock-stub/src/main.rs
@@ -0,0 +1,107 @@
+//! Windows-compatible mock executable stub.
+//!
+//! When invoked as `foo.exe`, runs `bash foo <args>` where `foo` is a companion
+//! shell script in the same directory. This allows Rust's Command::new() to find
+//! mock commands on Windows (CreateProcessW only searches for .exe files).
+//!
+//! Usage in tests:
+//! 1. Copy mock-stub.exe to bin_dir/gh.exe
+//! 2. Write shell script to bin_dir/gh
+//! 3. Command::new("gh") now works on Windows
+
+use std::env;
+use std::io::{self, Write};
+use std::path::Path;
+use std::process::{Command, Stdio, exit};
+
+/// Convert Windows path to MSYS2/Git Bash style path.
+///
+/// Git Bash expects Unix-style paths. When we pass a Windows path like
+/// `D:\temp\bin\gh` to bash, it doesn't understand it. Convert to `/d/temp/bin/gh`.
+fn to_msys_path(path: &Path) -> String {
+ let path_str = path.to_string_lossy();
+
+ // Check for Windows drive letter (e.g., "D:\...")
+ let chars: Vec<char> = path_str.chars().collect();
+ if chars.len() >= 2 && chars[1] == ':' {
+ // D:\foo\bar -> /d/foo/bar
+ let drive = chars[0].to_ascii_lowercase();
+ format!("/{}{}", drive, path_str[2..].replace('\\', "/"))
+ } else {
+ // Already Unix-style or relative path
+ path_str.replace('\\', "/")
+ }
+}
+
+fn main() {
+ let exe_path = env::current_exe().expect("failed to get executable path");
+
+ // Strip .exe extension to get companion script path
+ // e.g., /tmp/bin/gh.exe -> /tmp/bin/gh
+ let script_path = exe_path.with_extension("");
+
+ // Distinguish setup errors from environment errors
+ if !script_path.exists() {
+ eprintln!(
+ "mock-stub: companion script not found: {}",
+ script_path.display()
+ );
+ eprintln!("Check that write_mock_script() created the script file.");
+ exit(1);
+ }
+
+ // Convert to MSYS2-style path for bash on Windows
+ let script_path_str = to_msys_path(&script_path);
+
+ // Forward all arguments to bash with the script
+ let args: Vec<String> = env::args().skip(1).collect();
+
+ // Debug: Show what we're about to execute (only when MOCK_DEBUG is set)
+ if env::var("MOCK_DEBUG").is_ok() {
+ eprintln!("mock-stub: exe_path={}", exe_path.display());
+ eprintln!("mock-stub: script_path={}", script_path.display());
+ eprintln!("mock-stub: script_path_str={}", script_path_str);
+ eprintln!("mock-stub: args={:?}", args);
+ }
+
+ // Use .output() to capture stdout/stderr, then forward them.
+ // This is more reliable than relying on handle inheritance on Windows,
+ // which can fail silently when pipes are involved.
+ let output = Command::new("bash")
+ .arg(&script_path_str)
+ .args(&args)
+ .stdin(Stdio::inherit())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .output()
+ .unwrap_or_else(|e| {
+ eprintln!("mock-stub: failed to execute bash: {e}");
+ eprintln!("Is Git Bash installed and in PATH?");
+ exit(1);
+ });
+
+ // Debug: Show exit code and output lengths
+ if env::var("MOCK_DEBUG").is_ok() {
+ eprintln!(
+ "mock-stub: exit={} stdout_len={} stderr_len={}",
+ output.status.code().unwrap_or(-1),
+ output.stdout.len(),
+ output.stderr.len()
+ );
+ if !output.stderr.is_empty() {
+ eprintln!(
+ "mock-stub: stderr={}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ }
+ }
+
+ // Forward captured output to our stdout/stderr.
+ // Must flush before exit() since exit() doesn't run destructors.
+ io::stdout().write_all(&output.stdout).unwrap();
+ io::stdout().flush().unwrap();
+ io::stderr().write_all(&output.stderr).unwrap();
+ io::stderr().flush().unwrap();
+
+ exit(output.status.code().unwrap_or(1));
+}
diff --git a/tests/helpers/mock-stub/tests/builds.rs b/tests/helpers/mock-stub/tests/builds.rs
new file mode 100644
index 000000000..0c33c171f
--- /dev/null
+++ b/tests/helpers/mock-stub/tests/builds.rs
@@ -0,0 +1,5 @@
+//! Dummy test that triggers binary compilation.
+//! See dev-detach/Cargo.toml for why this is needed.
+
+#[test]
+fn dummy() {}
diff --git a/tests/integration_tests/ci_status.rs b/tests/integration_tests/ci_status.rs
index 14415e597..6f2711c0b 100644
--- a/tests/integration_tests/ci_status.rs
+++ b/tests/integration_tests/ci_status.rs
@@ -3,13 +3,17 @@
//! These tests verify that the CI status parsing code correctly handles
//! JSON responses from GitHub (gh) and GitLab (glab) CLI tools.
//!
-//! TODO: Re-enable on Windows once we have a reliable way to mock the `gh` command.
-//! Currently skipped because Rust's `Command::new("gh")` doesn't use PATHEXT for
-//! resolution - it looks for `.exe` directly. Our mock `gh.bat` scripts aren't
-//! found, so we can't mock the gh command reliably without creating a real `.exe`
-//! wrapper or modifying the source to use shell execution.
-
-#![cfg(not(windows))]
+//! ## Windows support
+//!
+//! These tests are currently skipped on Windows because the mock gh command
+//! infrastructure doesn't work reliably with the bash->JSON file reading
+//! pipeline. The mock-stub.exe successfully invokes bash, but the SCRIPT_DIR
+//! path resolution and JSON file reading fails in CI.
+//!
+//! See: https://github.com/max-sixty/worktrunk/issues/401
+//!
+//! Tests that only need simple mock behavior (e.g., `wt config show` which
+//! just checks if gh --version succeeds) work fine on Windows.
use crate::common::{TestRepo, make_snapshot_cmd, repo, setup_snapshot_settings};
use insta_cmd::assert_cmd_snapshot;
@@ -22,6 +26,7 @@ fn get_branch_sha(repo: &TestRepo, branch: &str) -> String {
/// Test CI status detection with GitHub PR showing passed checks
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_github_pr_passed(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -63,6 +68,7 @@ fn test_list_full_with_github_pr_passed(mut repo: TestRepo) {
/// Test CI status detection with GitHub PR showing failed checks
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_github_pr_failed(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -104,6 +110,7 @@ fn test_list_full_with_github_pr_failed(mut repo: TestRepo) {
/// Test CI status detection with GitHub PR showing running checks
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_github_pr_running(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -145,6 +152,7 @@ fn test_list_full_with_github_pr_running(mut repo: TestRepo) {
/// Test CI status detection with GitHub PR showing conflicts
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_github_pr_conflicts(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -186,6 +194,7 @@ fn test_list_full_with_github_pr_conflicts(mut repo: TestRepo) {
/// Test CI status detection with StatusContext (external CI like pre-commit.ci)
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_status_context_pending(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -227,6 +236,7 @@ fn test_list_full_with_status_context_pending(mut repo: TestRepo) {
/// Test CI status detection with StatusContext failure (external CI)
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_status_context_failure(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -268,6 +278,7 @@ fn test_list_full_with_status_context_failure(mut repo: TestRepo) {
/// Test CI status detection with no PR but workflow run
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_github_workflow_run(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -305,6 +316,7 @@ fn test_list_full_with_github_workflow_run(mut repo: TestRepo) {
/// Test CI status detection with workflow run in progress
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_github_workflow_running(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -342,6 +354,7 @@ fn test_list_full_with_github_workflow_running(mut repo: TestRepo) {
/// Test CI status with stale PR (local HEAD differs from PR HEAD)
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_stale_pr(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -384,6 +397,7 @@ fn test_list_full_with_stale_pr(mut repo: TestRepo) {
/// Test CI status detection with mixed CheckRun and StatusContext results
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_mixed_check_types(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -427,6 +441,7 @@ fn test_list_full_with_mixed_check_types(mut repo: TestRepo) {
/// Test CI status detection when PR has no checks configured
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_with_no_ci_checks(mut repo: TestRepo) {
// Add GitHub remote
repo.run_git(&[
@@ -466,6 +481,7 @@ fn test_list_full_with_no_ci_checks(mut repo: TestRepo) {
/// Test filtering PRs by repository owner
#[rstest]
+#[cfg_attr(windows, ignore = "mock gh JSON reading fails on Windows CI")]
fn test_list_full_filters_by_repo_owner(mut repo: TestRepo) {
// Add GitHub remote with specific owner
repo.run_git(&[
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index e3490a6f1..af7fabb88 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -1,11 +1,76 @@
use crate::common::{
- TestRepo, make_snapshot_cmd, merge_scenario, repo, repo_with_alternate_primary,
- repo_with_feature_worktree, repo_with_main_worktree, repo_with_multi_commit_feature,
+ TestRepo, make_snapshot_cmd, merge_scenario,
+ mock_commands::{
+ create_mock_cargo, create_mock_llm_api, create_mock_llm_auth, create_mock_pytest,
+ create_mock_ruff, create_mock_uv_pytest_ruff, create_mock_uv_sync,
+ },
+ repo, repo_with_alternate_primary, repo_with_feature_worktree, repo_with_main_worktree,
+ repo_with_multi_commit_feature, setup_snapshot_settings,
};
use insta_cmd::assert_cmd_snapshot;
use rstest::rstest;
use std::fs;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
+
+fn snapshot_switch_with_env(
+ test_name: &str,
+ repo: &TestRepo,
+ args: &[&str],
+ cwd: Option<&std::path::Path>,
+ env_vars: &[(&str, &str)],
+) {
+ let settings = setup_snapshot_settings(repo);
+ settings.bind(|| {
+ let mut cmd = make_snapshot_cmd(repo, "switch", args, cwd);
+ for (key, value) in env_vars {
+ cmd.env(key, value);
+ }
+ assert_cmd_snapshot!(test_name, cmd);
+ });
+}
+
+/// Create a PATH with the given mock bin directory prepended, preserving variable case.
+///
+/// Returns (variable_name, value) where variable_name preserves the case found
+/// in the environment (important for Windows where env vars are case-insensitive
+/// but Rust stores them case-sensitively - using "PATH" when the system has "Path"
+/// creates a duplicate).
+fn make_path_with_mock_bin(bin_dir: &Path) -> (String, String) {
+ // Find the actual PATH variable name to avoid creating a duplicate with different case
+ let (path_var_name, current_path) = std::env::vars_os()
+ .find(|(k, _)| k.eq_ignore_ascii_case("PATH"))
+ .map(|(k, v)| (k.to_string_lossy().into_owned(), Some(v)))
+ .unwrap_or(("PATH".to_string(), None));
+
+ let mut paths: Vec<PathBuf> = current_path
+ .as_deref()
+ .map(|p| std::env::split_paths(p).collect())
+ .unwrap_or_default();
+ paths.insert(0, bin_dir.to_path_buf());
+ let new_path = std::env::join_paths(&paths)
+ .unwrap()
+ .to_string_lossy()
+ .into_owned();
+
+ (path_var_name, new_path)
+}
+
+fn snapshot_merge_with_env(
+ test_name: &str,
+ repo: &TestRepo,
+ args: &[&str],
+ cwd: Option<&Path>,
+ env_vars: &[(&str, &str)],
+) {
+ let settings = setup_snapshot_settings(repo);
+ settings.bind(|| {
+ let mut cmd = make_snapshot_cmd(repo, "merge", args, cwd);
+ for (key, value) in env_vars {
+ cmd.env(key, value);
+ }
+ assert_cmd_snapshot!(test_name, cmd);
+ });
+}
#[rstest]
fn test_merge_fast_forward(merge_scenario: (TestRepo, PathBuf)) {
@@ -944,83 +1009,19 @@ pub fn refresh(refresh_token: &str) -> String {
///
/// Output is used in README.md "Advanced Features" or "Project Automation" section.
/// Source: tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
-///
-/// Skipped on Windows: Uses Unix shell commands (chmod, echo) for mock command scripts.
#[rstest]
-#[cfg_attr(windows, ignore)]
fn test_readme_example_complex(mut repo: TestRepo) {
// Create project config with multiple hooks
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- // Create mock commands for realistic output
+ // Create mock commands for realistic output (cross-platform)
let bin_dir = repo.root_path().join(".bin");
fs::create_dir_all(&bin_dir).unwrap();
- // Mock cargo that handles both test and clippy subcommands
- let cargo_script = r#"#!/bin/sh
-if [ "$1" = "test" ]; then
- echo " Finished test [unoptimized + debuginfo] target(s) in 0.12s"
- echo " Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)"
- echo ""
- echo "running 18 tests"
- echo "test auth::tests::test_jwt_decode ... ok"
- echo "test auth::tests::test_jwt_encode ... ok"
- echo "test auth::tests::test_token_refresh ... ok"
- echo "test auth::tests::test_token_validation ... ok"
- echo ""
- echo "test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s"
- exit 0
-elif [ "$1" = "clippy" ]; then
- echo " Checking worktrunk v0.1.0"
- echo " Finished dev [unoptimized + debuginfo] target(s) in 1.23s"
- exit 0
-elif [ "$1" = "install" ]; then
- echo " Installing worktrunk v0.1.0"
- echo " Compiling worktrunk v0.1.0"
- echo " Finished release [optimized] target(s) in 2.34s"
- echo " Installing ~/.cargo/bin/wt"
- echo " Installed package \`worktrunk v0.1.0\` (executable \`wt\`)"
- exit 0
-else
- echo "cargo: unknown subcommand '$1'"
- exit 1
-fi
-"#;
- fs::write(bin_dir.join("cargo"), cargo_script).unwrap();
-
- // Mock llm command that generates a high-quality commit message
- let llm_script = r#"#!/bin/sh
-# Read stdin (the prompt) but ignore it for deterministic output
-cat > /dev/null
-
-# Return a realistic, high-quality squash commit message
-cat << 'EOF'
-feat(auth): Implement JWT authentication system
-
-Add comprehensive JWT token handling including validation, refresh logic,
-and authentication tests. This establishes the foundation for secure
-API authentication.
-
-- Implement token refresh mechanism with expiry handling
-- Add JWT encoding/decoding with signature verification
-- Create test suite covering all authentication flows
-EOF
-"#;
- fs::write(bin_dir.join("llm"), llm_script).unwrap();
-
- // Make scripts executable (Unix only - Windows doesn't use executable bits)
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- let mut perms = fs::metadata(bin_dir.join("cargo")).unwrap().permissions();
- perms.set_mode(0o755);
- fs::set_permissions(bin_dir.join("cargo"), perms).unwrap();
-
- let mut perms = fs::metadata(bin_dir.join("llm")).unwrap().permissions();
- perms.set_mode(0o755);
- fs::set_permissions(bin_dir.join("llm"), perms).unwrap();
- }
+ // Create cross-platform mock commands
+ create_mock_cargo(&bin_dir);
+ create_mock_llm_auth(&bin_dir);
let config_content = r#"
[pre-merge]
@@ -1092,35 +1093,27 @@ mod tests {
repo.run_git_in(&feature_wt, &["commit", "-m", "Add authentication tests"]);
// Configure LLM in worktrunk config for deterministic, high-quality commit messages
- let llm_path = bin_dir.join("llm");
+ // On Windows, direct execution needs .cmd extension; use forward slashes for shell compatibility
+ let llm_name = if cfg!(windows) { "llm.cmd" } else { "llm" };
+ let llm_path = bin_dir.join(llm_name);
+ let llm_path_str = llm_path.to_string_lossy().replace('\\', "/");
let worktrunk_config = format!(
r#"
[commit-generation]
-command = "{}"
-"#,
- llm_path.display()
+command = "{llm_path_str}"
+"#
);
fs::write(repo.test_config_path(), worktrunk_config).unwrap();
// Merge with --yes to skip approval prompts for commands
- // This test explicitly sets PATH (which will be captured in snapshot) because it needs
- // to find mock commands in .bin directory. We use a clean, minimal PATH to avoid leaking
- // user-specific paths like ~/.cargo/bin into the snapshot.
- //
- // TODO: This hardcoded PATH works on macOS and Linux CI, but may not work on all
- // environments (e.g., Windows, other package managers like nixpkgs). We should
- // reassess whether there's a better approach that doesn't require hardcoding
- // system paths. Ideally we'd avoid setting PATH entirely, but this test needs it
- // for mock commands.
- let path_with_bin = format!(
- "{}:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
- bin_dir.display()
+ let (path_var, path_with_bin) = make_path_with_mock_bin(&bin_dir);
+ snapshot_merge_with_env(
+ "readme_example_complex",
+ &repo,
+ &["main", "--yes"],
+ Some(&feature_wt),
+ &[(&path_var, &path_with_bin)],
);
- assert_cmd_snapshot!({
- let mut cmd = make_snapshot_cmd(&repo, "merge", &["main", "--yes"], Some(&feature_wt));
- cmd.env("PATH", &path_with_bin);
- cmd
- });
}
/// Generate README example: Creating worktree with post-create and post-start hooks
@@ -1128,45 +1121,17 @@ command = "{}"
///
/// Output is used in README.md "Project Hooks" section.
/// Source: tests/snapshots/integration__integration_tests__merge__readme_example_hooks_post_create.snap
-///
-/// Skipped on Windows: Uses Unix shell commands (chmod, echo) for mock command scripts.
#[rstest]
-#[cfg_attr(windows, ignore)]
fn test_readme_example_hooks_post_create(repo: TestRepo) {
// Create project config with post-create and post-start hooks
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- // Create mock commands for realistic output
+ // Create mock commands for realistic output (cross-platform)
let bin_dir = repo.root_path().join(".bin");
fs::create_dir_all(&bin_dir).unwrap();
- // Mock uv command that simulates dependency installation
- let uv_script = r#"#!/bin/sh
-if [ "$1" = "sync" ]; then
- echo ""
- echo " Resolved 24 packages in 145ms"
- echo " Installed 24 packages in 1.2s"
- exit 0
-elif [ "$1" = "run" ] && [ "$2" = "dev" ]; then
- echo ""
- echo " Starting dev server on http://localhost:3000..."
- exit 0
-else
- echo "uv: unknown command '$1 $2'"
- exit 1
-fi
-"#;
- fs::write(bin_dir.join("uv"), uv_script).unwrap();
-
- // Make scripts executable (Unix only)
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- let mut perms = fs::metadata(bin_dir.join("uv")).unwrap().permissions();
- perms.set_mode(0o755);
- fs::set_permissions(bin_dir.join("uv"), perms).unwrap();
- }
+ create_mock_uv_sync(&bin_dir);
let config_content = r#"
[post-create]
@@ -1183,16 +1148,14 @@ fi
repo.run_git(&["commit", "-m", "Add project hooks"]);
// Set PATH to include mock commands and run switch --create with --yes
- let path_with_bin = format!(
- "{}:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
- bin_dir.display()
+ let (path_var, path_with_bin) = make_path_with_mock_bin(&bin_dir);
+ snapshot_switch_with_env(
+ "readme_example_hooks_post_create",
+ &repo,
+ &["--create", "feature-x", "--yes"],
+ None,
+ &[(&path_var, &path_with_bin)],
);
-
- assert_cmd_snapshot!("readme_example_hooks_post_create", {
- let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", "feature-x", "--yes"], None);
- cmd.env("PATH", &path_with_bin);
- cmd
- });
}
/// Generate README example: Merging with pre-merge hooks (test and lint)
@@ -1200,87 +1163,20 @@ fi
///
/// Output is used in README.md "Project Hooks" section.
/// Source: tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
-///
-/// Skipped on Windows: Uses Unix shell commands (chmod, echo) for mock command scripts.
#[rstest]
-#[cfg_attr(windows, ignore)]
fn test_readme_example_hooks_pre_merge(mut repo: TestRepo) {
// Create project config with pre-merge hooks
let config_dir = repo.root_path().join(".config");
fs::create_dir_all(&config_dir).unwrap();
- // Create mock commands for realistic output
+ // Create mock commands for realistic output (cross-platform)
let bin_dir = repo.root_path().join(".bin");
fs::create_dir_all(&bin_dir).unwrap();
- // Mock pytest command
- let pytest_script = r#"#!/bin/sh
-cat << 'EOF'
-
-============================= test session starts ==============================
-collected 3 items
-
-tests/test_auth.py::test_login_success PASSED [ 33%]
-tests/test_auth.py::test_login_invalid_password PASSED [ 66%]
-tests/test_auth.py::test_token_validation PASSED [100%]
-
-============================== 3 passed in 0.8s ===============================
-
-EOF
-exit 0
-"#;
- fs::write(bin_dir.join("pytest"), pytest_script).unwrap();
-
- // Mock ruff command
- let ruff_script = r#"#!/bin/sh
-if [ "$1" = "check" ]; then
- echo ""
- echo "All checks passed!"
- echo ""
- exit 0
-else
- echo "ruff: unknown command '$1'"
- exit 1
-fi
-"#;
- fs::write(bin_dir.join("ruff"), ruff_script).unwrap();
-
- // Mock llm command for commit message
- let llm_script = r#"#!/bin/sh
-cat > /dev/null
-cat << 'EOF'
-feat(api): Add user authentication endpoints
-
-Implement login and token refresh endpoints with JWT validation.
-Includes comprehensive test coverage and input validation.
-EOF
-"#;
- fs::write(bin_dir.join("llm"), llm_script).unwrap();
-
- // Mock uv command for running pytest and ruff
- let uv_script = r#"#!/bin/sh
-if [ "$1" = "run" ] && [ "$2" = "pytest" ]; then
- exec pytest
-elif [ "$1" = "run" ] && [ "$2" = "ruff" ]; then
- shift 2
- exec ruff "$@"
-else
- echo "uv: unknown command '$1 $2'"
- exit 1
-fi
-"#;
- fs::write(bin_dir.join("uv"), uv_script).unwrap();
-
- // Make scripts executable (Unix only)
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- for script in &["pytest", "ruff", "llm", "uv"] {
- let mut perms = fs::metadata(bin_dir.join(script)).unwrap().permissions();
- perms.set_mode(0o755);
- fs::set_permissions(bin_dir.join(script), perms).unwrap();
- }
- }
+ create_mock_pytest(&bin_dir);
+ create_mock_ruff(&bin_dir);
+ create_mock_llm_api(&bin_dir);
+ create_mock_uv_pytest_ruff(&bin_dir);
let config_content = r#"
[pre-merge]
@@ -1381,26 +1277,27 @@ def refresh_token(token: str) -> Optional[Dict]:
repo.run_git_in(&feature_wt, &["commit", "-m", "Add validation"]);
// Configure LLM in worktrunk config
- let llm_path = bin_dir.join("llm");
+ // On Windows, direct execution needs .cmd extension; use forward slashes for shell compatibility
+ let llm_name = if cfg!(windows) { "llm.cmd" } else { "llm" };
+ let llm_path = bin_dir.join(llm_name);
+ let llm_path_str = llm_path.to_string_lossy().replace('\\', "/");
let worktrunk_config = format!(
r#"
[commit-generation]
-command = "{}"
-"#,
- llm_path.display()
+command = "{llm_path_str}"
+"#
);
fs::write(repo.test_config_path(), worktrunk_config).unwrap();
// Set PATH and merge with --yes
- let path_with_bin = format!(
- "{}:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
- bin_dir.display()
+ let (path_var, path_with_bin) = make_path_with_mock_bin(&bin_dir);
+ snapshot_merge_with_env(
+ "readme_example_hooks_pre_merge",
+ &repo,
+ &["main", "--yes"],
+ Some(&feature_wt),
+ &[(&path_var, &path_with_bin)],
);
- assert_cmd_snapshot!({
- let mut cmd = make_snapshot_cmd(&repo, "merge", &["main", "--yes"], Some(&feature_wt));
- cmd.env("PATH", &path_with_bin);
- cmd
- });
}
#[rstest]
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_directive_file.snap b/tests/snapshots/integration__integration_tests__directives__merge_directive_file.snap
index e400f269c..857fc84a6 100644
--- a/tests/snapshots/integration__integration_tests__directives__merge_directive_file.snap
+++ b/tests/snapshots/integration__integration_tests__directives__merge_directive_file.snap
@@ -24,6 +24,7 @@ info:
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
WORKTRUNK_DIRECTIVE_FILE: "[DIRECTIVE_FILE]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -31,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snap
index 04a5c3fde..cdeb97783 100644
--- a/tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snap
+++ b/tests/snapshots/integration__integration_tests__directives__merge_directive_no_remove.snap
@@ -24,7 +24,8 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
- WORKTRUNK_DIRECTIVE_FILE: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpG9gkyL
+ WORKTRUNK_DIRECTIVE_FILE: "[DIRECTIVE_FILE]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -32,8 +33,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snap
index e400f269c..857fc84a6 100644
--- a/tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snap
+++ b/tests/snapshots/integration__integration_tests__directives__merge_directive_remove.snap
@@ -24,6 +24,7 @@ info:
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
WORKTRUNK_DIRECTIVE_FILE: "[DIRECTIVE_FILE]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -31,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_as_git_subcommand.snap b/tests/snapshots/integration__integration_tests__merge__merge_as_git_subcommand.snap
index cccde9539..4786a7a72 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_as_git_subcommand.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_as_git_subcommand.snap
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 24a1a2c9d..d26789ef9 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
@@ -35,9 +35,9 @@ exit_code: 0
↳ Backup created @ 14fc72d
◎ Generating squash commit message...
  fix: update file 1 content
-✓ Squashed @ f1c474c
-◎ Merging 1 commit to main @ f1c474c (no rebase needed)
-  * f1c474c fix: update file 1 content
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] 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 9132efa7c..6c5b8d46a 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
@@ -39,9 +39,9 @@ exit_code: 0
 
  Combined commits:
  - feat: initial feature
-✓ Squashed @ d3582c0
-◎ Merging 1 commit to main @ d3582c0 (no rebase needed)
-  * d3582c0 Squash commits from main
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] Squash commits from main
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 f5055cfe4..fe8ba2e2d 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
@@ -35,9 +35,9 @@ exit_code: 0
↳ Backup created @ 5e120d3
◎ Generating squash commit message...
  fix: improve auth validation logic
-✓ Squashed @ 88fed03
-◎ Merging 1 commit to main @ 88fed03 (no rebase needed)
-  * 88fed03 fix: improve auth validation logic
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] fix: improve auth validation logic
  auth.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 09e37d29e..88701313d 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
@@ -36,9 +36,9 @@ exit_code: 0
◎ 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 @ b44b09f
-◎ Merging 1 commit to main @ b44b09f (no rebase needed)
-  * b44b09f Changes to dirty.txt
+✓ Committed changes @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] Changes to dirty.txt
  dirty.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 28df19778..0104d5542 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
index 66b10b54c..331377d21 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_no_squash_no_remove_redundant.snap
@@ -34,8 +34,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 0f1a1349f..3784c10be 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
@@ -25,6 +25,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -34,8 +35,8 @@ exit_code: 0
----- stderr -----
◎ Rebasing onto main...
✓ Rebased onto main
-◎ Merging 1 commit to main @ 430212e (no commit/squash needed)
-  * 430212e Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
index f40540023..8c3bf13c0 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commit_with_clean_tree.snap
@@ -33,8 +33,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 17f098742..5b07807d1 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
@@ -36,9 +36,9 @@ exit_code: 0
◎ 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 @ bbcee27
-◎ Merging 1 commit to main @ bbcee27 (no rebase needed)
-  * bbcee27 Changes to newfile.txt
+✓ Committed changes @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] Changes to newfile.txt
  newfile.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_already_rebased.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_already_rebased.snap
index 0d3301d3b..752826dac 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_already_rebased.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_rebase_when_already_rebased.snap
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 957add793..d38f0364e 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
@@ -30,8 +30,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 9fab30bcd..aca44f461 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
@@ -32,9 +32,9 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 2 commits to main @ f0d31ff (no commit/squash/rebase needed)
-  * f0d31ff feat: add file 2
-  * 65fe669 feat: add file 1
+◎ Merging 2 commits to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] feat: add file 2
+  * [HASH] feat: add file 1
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
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 5f9a5189c..0104d5542 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
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ 430212e (no commit/squash/rebase needed)
-  * 430212e Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 907ce77ec..0d1db492f 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
@@ -32,8 +32,8 @@ exit_code: 1
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ 623e1f1 (no commit/squash/rebase needed)
-  * 623e1f1 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
index 3e37f0a09..bbd988c55 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
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ 40d535b (no commit/squash/rebase needed)
-  * 40d535b Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_skipped_with_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_skipped_with_no_verify.snap
index 105ab216c..03ad49224 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_skipped_with_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_skipped_with_no_verify.snap
@@ -33,8 +33,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ 75e8546 (no commit/squash/rebase needed)
-  * 75e8546 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 a7c2c71ec..4ab43b4ed 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
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ 75e8546 (no commit/squash/rebase needed)
-  * 75e8546 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 743558139..67ae94d32 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
@@ -40,9 +40,9 @@ exit_code: 0
◎ 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 @ fce4243
-◎ Merging 1 commit to main @ fce4243 (no rebase needed)
-  * fce4243 Changes to feature.txt
+✓ Committed changes @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] Changes to feature.txt
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 4018ef32e..5a8bc14f0 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
@@ -38,8 +38,8 @@ exit_code: 0
  exit 0
◎ Running pre-merge project:test:
  exit 0
-◎ Merging 1 commit to main @ 4a48dbd (no commit/squash/rebase needed)
-  * 4a48dbd Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_no_hooks.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_no_hooks.snap
index 8bb7c5588..b6efd3828 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_no_hooks.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_no_hooks.snap
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ a3a6eaf (no commit/squash/rebase needed)
-  * a3a6eaf Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 170a61ef3..5ace19a49 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
@@ -34,8 +34,8 @@ exit_code: 0
----- stderr -----
◎ Running pre-merge project hook:
  exit 0
-◎ Merging 1 commit to main @ 4f5863f (no commit/squash/rebase needed)
-  * 4f5863f Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 93612c6c9..6a02f6a8b 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
@@ -35,8 +35,8 @@ exit_code: 0
◎ Running pre-commit project hook:
  echo 'Pre-commit check passed'
Pre-commit check passed
-◎ Merging 1 commit to main @ ef627f5 (no commit/squash/rebase needed)
-  * ef627f5 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 08b06be6c..534762c93 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
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 6dbd32024..0e88190bd 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
@@ -33,8 +33,8 @@ exit_code: 0
----- stderr -----
◎ Rebasing onto main...
✓ Rebased onto main
-◎ Merging 1 commit to main @ eadc502 (no commit/squash needed)
-  * eadc502 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
index 9121c0da0..1e8c80c42 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_commit_after_push.snap
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 6aee4ba0b..f87737047 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
@@ -33,8 +33,8 @@ exit_code: 0
----- stderr -----
◎ Rebasing onto main...
✓ Rebased onto main
-◎ Merging 1 commit to main @ a5e5492 (no commit/squash needed)
-  * a5e5492 Add feature
+◎ Merging 1 commit to main @ [HASH] (no commit/squash needed)
+  * [HASH] Add feature
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 caaba4f07..5af5f8ac6 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -40,9 +40,9 @@ exit_code: 0
  - feat: add file 1
  - fix: update logic
  - docs: update readme
-✓ Squashed @ af8c227
-◎ Merging 1 commit to main @ af8c227 (no rebase needed)
-  * af8c227 Squash commits from main
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] Squash commits from main
  file1.txt | 1 +
  file2.txt | 1 +
  file3.txt | 1 +
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 5157dd27b..2f2aa23b4 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
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ c2e3582 (no commit/squash/rebase needed)
-  * c2e3582 feat: single commit
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] feat: single commit
  file1.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 955f44221..32c2246ef 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
@@ -34,9 +34,9 @@ exit_code: 0
◎ Squashing 2 commits into a single commit (1 file, +1)...
◎ Generating squash commit message...
  feat: implement user authentication system
-✓ Squashed @ 785d1ff
-◎ Merging 1 commit to main @ 785d1ff (no rebase needed)
-  * 785d1ff feat: implement user authentication system
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] feat: implement user authentication system
  auth.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 5a77936ce..927327f05 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
@@ -37,9 +37,9 @@ exit_code: 0
↳ Backup created @ 14fc72d
◎ Generating squash commit message...
  fix: update files
-✓ Squashed @ 257ac9f
-◎ Merging 1 commit to main @ 257ac9f (no rebase needed)
-  * 257ac9f fix: update files
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] fix: update files
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default_branch.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default_branch.snap
index 957add793..d38f0364e 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default_branch.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default_branch.snap
@@ -30,8 +30,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 3e3f525da..c374ff543 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
@@ -33,8 +33,8 @@ exit_code: 0
----- stderr -----
◎ Rebasing onto staging...
✓ Rebased onto staging
-◎ Merging 1 commit to staging @ 278a642 (no commit/squash needed)
-  * 278a642 Add feature for staging
+◎ Merging 1 commit to staging @ [HASH] (no commit/squash needed)
+  * [HASH] Add feature for staging
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to staging (1 commit, 1 file, +1)
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 28df19778..0104d5542 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
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_caret_symbol.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_caret_symbol.snap
index cea00dcc3..1fd0d481b 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_caret_symbol.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_caret_symbol.snap
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap
index 9121c0da0..1e8c80c42 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove_flag.snap
@@ -32,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ fc12499 (no commit/squash/rebase needed)
-  * fc12499 Add feature file
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
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 d39564602..2e19f7f79 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
@@ -40,9 +40,9 @@ exit_code: 0
↳ Backup created @ fefa700
◎ Generating squash commit message...
  fix: commit changes
-✓ Squashed @ 69f015f
-◎ Merging 1 commit to main @ 69f015f (no rebase needed)
-  * 69f015f fix: commit changes
+✓ Squashed @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] fix: commit changes
  file1.txt | 1 +
  untracked1.txt | 1 +
  untracked2.txt | 1 +
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 734f8c3f8..ee06d5db8 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
@@ -43,7 +43,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 @ 85d3884
+✓ Squashed @ [HASH]
◎ Running pre-merge project:test:
  cargo test
 Finished test [unoptimized + debuginfo] target(s) in 0.12s
@@ -60,8 +60,8 @@ test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
  cargo clippy
 Checking worktrunk v0.1.0
Finished dev [unoptimized + debuginfo] target(s) in 1.23s
-◎ Merging 1 commit to main @ 85d3884 (no rebase needed)
-  * 85d3884 feat(auth): Implement JWT authentication system
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] feat(auth): Implement JWT authentication system
  auth.rs | 8 ++++++++
  auth_test.rs | 17 +++++++++++++++++
  jwt.rs | 8 ++++++++
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 9d306479b..a60a3e2d1 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
@@ -38,7 +38,7 @@ exit_code: 0
 
  Implement login and token refresh endpoints with JWT validation.
  Includes comprehensive test coverage and input validation.
-✓ Squashed @ 7323bc5
+✓ Squashed @ [HASH]
◎ Running pre-merge project:test:
  uv run pytest
@@ -50,14 +50,13 @@ tests/test_auth.py::test_login_invalid_password PASSED [ 66%]
tests/test_auth.py::test_token_validation PASSED [100%]
============================== 3 passed in 0.8s ===============================
-
◎ Running pre-merge project:lint:
  uv run ruff check
All checks passed!
-◎ Merging 1 commit to main @ 7323bc5 (no rebase needed)
-  * 7323bc5 feat(api): Add user authentication endpoints
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] 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 a046ce846..27990d737 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
@@ -31,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ 8f777c3 (no commit/squash/rebase needed)
-  * 8f777c3 Implement JWT validation
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Implement JWT validation
  auth.rs | 13 +++++++++++++
  1 file changed, 13 insertions(+)
✓ Merged to main (1 commit, 1 file, +13)
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap
index 06434ddcf..cf72b323b 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_with_both_flags.snap
@@ -38,4 +38,4 @@ exit_code: 0
○ Skipping pre-commit hooks (--no-verify)
◎ Generating commit message and committing tracked changes... (1 file, +1, -1)
  fix: update file
-✓ Committed changes @ b92c41b
+✓ Committed changes @ [HASH]
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap
index 0544495c8..819250193 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_with_no_verify_flag.snap
@@ -40,4 +40,4 @@ exit_code: 0
  file1.txt
◎ Generating commit message and committing changes... (2 files, +2)
  feat: add file
-✓ Committed changes @ 388183d
+✓ Committed changes @ [HASH]
diff --git a/tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap b/tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap
index fd605d454..2205f96c8 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_commit_with_stage_tracked_flag.snap
@@ -36,4 +36,4 @@ exit_code: 0
----- stderr -----
◎ Generating commit message and committing tracked changes... (1 file, +1, -1)
  fix: update tracked file
-✓ Committed changes @ 0495397
+✓ Committed changes @ [HASH]
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap
index d9b27213c..3791ceb3c 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_with_both_flags.snap
@@ -40,4 +40,4 @@ exit_code: 0
↳ Backup created @ ef0df66
◎ Generating squash commit message...
  squash: combined commits
-✓ Squashed @ 3c1afb6
+✓ Squashed @ [HASH]
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap
index 022aa4d60..897751625 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_with_no_verify_flag.snap
@@ -38,4 +38,4 @@ exit_code: 0
◎ Squashing 2 commits into a single commit (3 files, +3)...
◎ Generating squash commit message...
  squash: combined commits
-✓ Squashed @ fc99904
+✓ Squashed @ [HASH]
diff --git a/tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap b/tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap
index b84343df9..666683afc 100644
--- a/tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap
+++ b/tests/snapshots/integration__integration_tests__merge__step_squash_with_stage_tracked_flag.snap
@@ -38,4 +38,4 @@ exit_code: 0
↳ Backup created @ 6aa1805
◎ Generating squash commit message...
  squash: combined commits
-✓ Squashed @ 7335b29
+✓ Squashed @ [HASH]
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 7757111b2..8e4e04b3c 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
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -32,8 +33,8 @@ exit_code: 0
----- stderr -----
◎ Stashing changes in _REPO_...
-◎ Pushing 1 commit to main @ fc12499
-  * fc12499 Add feature file
+◎ Pushing 1 commit to main @ [HASH]
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
◎ Restoring stashed changes in _REPO_...
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 79872c330..2424343da 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
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: false
@@ -32,6 +33,6 @@ exit_code: 1
----- stderr -----
✗ Can't push to local main branch: it has newer commits
-  * 54bc2d7 Main commit
+  * [HASH] Main commit
↳ To rebase onto main, run wt step rebase main
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 8a9627ed1..06a4b39b4 100644
--- a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -31,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Pushing 1 commit to main @ e26c61d
-  * e26c61d Add test file
+◎ Pushing 1 commit to main @ [HASH]
+  * [HASH] Add test file
  test.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Pushed to main (1 commit, 1 file, +1)
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 2ddeb07f5..609beba39 100644
--- a/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_no_remote.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -30,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Pushing 1 commit to main @ fc12499
-  * fc12499 Add feature file
+◎ Pushing 1 commit to main @ [HASH]
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Pushed to main (1 commit, 1 file, +1)
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 011193fec..728f02751 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
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -31,8 +32,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Pushing 1 commit to main @ 430212e
-  * 430212e Add feature file
+◎ Pushing 1 commit to main @ [HASH]
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Pushed to main (1 commit, 1 file, +1)
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 2ddeb07f5..609beba39 100644
--- a/tests/snapshots/integration__integration_tests__push__push_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_to_default.snap
@@ -23,6 +23,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -30,8 +31,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Pushing 1 commit to main @ fc12499
-  * fc12499 Add feature file
+◎ Pushing 1 commit to main @ [HASH]
+  * [HASH] Add feature file
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Pushed to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__push__push_with_merge_commits.snap b/tests/snapshots/integration__integration_tests__push__push_with_merge_commits.snap
index c848398dd..d7376c715 100644
--- a/tests/snapshots/integration__integration_tests__push__push_with_merge_commits.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_with_merge_commits.snap
@@ -24,6 +24,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -31,12 +32,12 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Pushing 3 commits to main @ 2489484
+◎ Pushing 3 commits to main @ [HASH]
  * 2489484 Merge temp
  |/
-  | * e03c938 Commit 2
+  | * [HASH] Commit 2
  |/
-  * 9ca7ddd Commit 1
+  * [HASH] Commit 1
  file1.txt | 1 +
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap
index e3ca74a54..fa6b5f58a 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_post_merge_executes.snap
@@ -25,6 +25,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -32,8 +33,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ d233817 (no commit/squash/rebase needed)
-  * d233817 Add feature
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_executes.snap
index 6dbcaaf30..a66cb2af4 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_commit_executes.snap
@@ -25,6 +25,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -39,9 +40,9 @@ exit_code: 0
◎ 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 uncommitted.txt
-✓ Committed changes @ fc0fed2
-◎ Merging 1 commit to main @ fc0fed2 (no rebase needed)
-  * fc0fed2 Changes to uncommitted.txt
+✓ Committed changes @ [HASH]
+◎ Merging 1 commit to main @ [HASH] (no rebase needed)
+  * [HASH] Changes to uncommitted.txt
  uncommitted.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_executes.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_executes.snap
index 9336dfcb5..ec6c8db2f 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_executes.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_executes.snap
@@ -25,6 +25,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -34,8 +35,8 @@ exit_code: 0
----- stderr -----
◎ Running pre-merge user:check:
  echo 'USER_PRE_MERGE_RAN' > user_premerge.txt
-◎ Merging 1 commit to main @ d233817 (no commit/squash/rebase needed)
-  * d233817 Add feature
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)
diff --git a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped_no_verify.snap b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped_no_verify.snap
index d01e16941..c24a31131 100644
--- a/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__user_hooks__user_pre_merge_skipped_no_verify.snap
@@ -26,6 +26,7 @@ info:
SOURCE_DATE_EPOCH: "1735776000"
USERPROFILE: "[TEST_HOME]"
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
---
success: true
@@ -33,8 +34,8 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Merging 1 commit to main @ d233817 (no commit/squash/rebase needed)
-  * d233817 Add feature
+◎ Merging 1 commit to main @ [HASH] (no commit/squash/rebase needed)
+  * [HASH] Add feature
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✓ Merged to main (1 commit, 1 file, +1)