Conversation
Now that we've verified echo commands work through Git Bash on Windows, enable all tests that use shell commands like 'echo ... > file.txt'. Remaining 19 Windows-ignored tests have actual platform incompatibilities: - chmod command (Unix only) - File locking during worktree removal - git status CRLF/LF differences - /tmp paths - cat command 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Selectively enable tests that use:
- Simple echo commands without path template variables
- Non-path template variables ({{ branch }}, {{ target }}, {{ default_branch }})
Tests using path template variables ({{ worktree }}, {{ main_worktree }},
{{ repo_root }}, {{ worktree_name }}) remain ignored due to shell quoting
differences when these paths are echoed on Windows via Git Bash.
Enabled tests by file:
- approval_ui.rs: 7 tests
- merge.rs: 3 tests
- switch.rs: 2 tests
- user_hooks.rs: 2 tests
- remove.rs: 1 test
- post_start_commands.rs: 1 test
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Convert Windows native paths (D:\...) to POSIX format (/d/...) in hook context variables. This avoids shell escaping of `:` and `\` characters that caused snapshot mismatches between Windows and Unix. The root cause was that shell_escape::escape() uses unix escaping when MSYSTEM is set (as it is in Git Bash), and Windows paths contain characters not in the unix safe character set, causing them to be wrapped in single quotes. Changes: - Add to_posix_path() helper for Git Bash compatibility - Update build_hook_context() to use POSIX paths for worktree/repo_root - Enable 15+ tests that were previously skipped due to path differences 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The to_posix_path() conversion in command_executor.rs converts Windows
paths like C:\Users\...\repo to POSIX format /c/Users/.../repo for Git
Bash compatibility. However, snapshot redaction patterns weren't catching
these POSIX-formatted paths.
Add:
- to_posix_path() helper in test common module
- POSIX path filters for repo and worktree paths
- Regex fallback pattern for POSIX-style Windows temp paths
This ensures template variables like ${worktree} and ${repo_root} are
properly redacted in snapshots regardless of path format.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Instead of hand-rolling POSIX path conversion, use cygpath from Git for Windows which handles all edge cases (UNC paths, verbatim paths, etc.). - Derive cygpath location from cached ShellConfig (no duplicate Git-finding) - Fall back to pass-through if cygpath unavailable - Remove duplicate to_posix_path implementations from command_executor and tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
D:\...) to POSIX format (/d/...) for Git Bash compatibilityRoot Cause
When Git Bash executes commands, it sets
MSYSTEMenvironment variable. Theshell_escape::escape()function detects this and uses unix escaping. However, Windows paths contain:and\characters which are NOT in the unix safe character set, causing them to be wrapped in single quotes.This caused snapshot mismatches between Windows and Unix because:
/tmp/test/repo→ no escaping needed (all safe chars)D:\a\worktrunk\repo→ gets quoted as'D:\a\worktrunk\repo'Solution
Convert Windows paths to POSIX format (
/d/a/worktrunk/repo) inbuild_hook_context()before template expansion. This ensures:🤖 Generated with Claude Code