fix: use cygpath -ma on Windows so cmux ls path filter matches#23
Open
jeremylasne92-hue wants to merge 1 commit into
Open
fix: use cygpath -ma on Windows so cmux ls path filter matches#23jeremylasne92-hue wants to merge 1 commit into
jeremylasne92-hue wants to merge 1 commit into
Conversation
On Windows (Git Bash / MSYS), `realpath` returns POSIX form (/c/Users/...) while `git worktree list` emits mixed form (C:/Users/...). The grep-based filter in `_cmux_ls` (and derived commands like `cmux rm --all`) therefore never matches any worktree, producing an empty listing even when worktrees exist. Fix: introduce `_cmux_canonical_path` that uses `cygpath -ma` (absolute + mixed format) when available, falling back to `realpath` on Linux/macOS. `_cmux_repo_root` now delegates to this helper. Verified on Windows Git Bash (MSYS, bash 5.2, git 2.52): `cmux new`, `cmux ls`, `cmux rm <branch>` all behave correctly post-fix. Linux behavior is unchanged (cygpath is not present, realpath path runs).
Collaborator
|
On principal I'm onboard with this, thanks! I don't want to place an extra burden on you but without a Windows machine (@craigsc & I both use macOS) I can't test this and I'm not sure we'll be able to support it. Would it be a fair ask for you to add a Windows GitHub Actions runner config to this so we can make sure it stays supported and working properly? I don't want to break stuff for you later on and we need to be able to maintain it. I do think Windows support should be limited to Cygwin & WSL tho. |
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.
Fixes #22
Problem
On Windows (Git Bash / MSYS),
cmux lsandcmux rm --allsilently return empty because the path filter never matches:realpathon MSYS returns POSIX form:/c/Users/foo/repogit worktree listemits mixed form:C:/Users/foo/repogrep -F "$filter"comparing these two strings yields zero matchesFix
Introduce
_cmux_canonical_pathhelper that preferscygpath -ma(absolute + mixed format) when available, falling back torealpatheverywhere else._cmux_repo_rootdelegates to this helper.cygpathon PATH → realpath branch runs)git worktree listoutput formatVerification
On Windows Git Bash (MSYS2/MINGW64, bash 5.2.37, git 2.52.0.windows.1):
Before the fix:
cmux lsalways empty. After the fix: worktrees are listed correctly.Linux path (unchanged): running the same code in a non-MSYS environment takes the
realpathbranch sincecygpathis not available.Scope
Minimal one-function change (
cmux.sh, +15 / -2). No new dependencies, no test additions (repo has no test suite perCLAUDE.md).