Skip to content

Fix Windows/Git-Bash path comparison in test-sdd-workspace.sh - #2149

Open
t0domanh wants to merge 1 commit into
obra:mainfrom
t0domanh:fix/sdd-test-windows-path-normalization
Open

Fix Windows/Git-Bash path comparison in test-sdd-workspace.sh#2149
t0domanh wants to merge 1 commit into
obra:mainfrom
t0domanh:fix/sdd-test-windows-path-normalization

Conversation

@t0domanh

Copy link
Copy Markdown

Summary

  • tests/claude-code/test-sdd-workspace.sh string-compares a git rev-parse --show-toplevel result against sdd-workspace's own printed output, which is always normalized through a final cd "$dir" && pwd.
  • On Windows Git Bash/MSYS these two commands can print different spellings of the identical physical directory (git rev-parse --show-toplevel prints Windows-style C:/Users/..., while cd ... && pwd prints MSYS-style /c/Users/...). The string comparison then fails even though both sides name the same directory — 5 of 13 assertions failed on a Windows 10 + Git Bash machine before this fix.
  • Adds a physical_path() helper ((cd "$1" && pwd)) and applies it to both places the test derives a comparison root from git rev-parse --show-toplevel (repo and wt_root), pushing them through the same normalization sdd-workspace's printed output already goes through.
  • No-op on Linux/macOS, where git rev-parse --show-toplevel and cd ... && pwd already agree (modulo the resolved-symlink /var/private/var case the existing comment already handles) — cd "$X" && pwd on an already-canonical path returns $X unchanged.

Test plan

  • bash tests/claude-code/test-sdd-workspace.sh — 13/13 assertions pass on Windows 10 + Git Bash after this change (5 previously failed: "prints <repo-root>/.superpowers/sdd/<plan>", "task-brief writes its brief…", "review-package writes its diff…", "linked worktree resolves its own distinct workspace", plus a related worktree assertion)
  • Confirmed the change is additive-only (a normalization pass, not a change to what's compared) — no regression risk on platforms where the two forms already agree

git rev-parse --show-toplevel and cd ... && pwd can print different
spellings of the same physical directory on Windows Git Bash/MSYS
(Windows-style C:/Users/... vs MSYS-style /c/Users/...). The test
string-compares a git rev-parse --show-toplevel result against
sdd-workspace's own printed output, which is always normalized through
a final cd "$dir" && pwd — so the comparison fails spuriously on
Windows even though both sides name the same directory.

Add a physical_path() helper that pushes repo/wt_root through the same
cd ... && pwd normalization sdd-workspace's output already receives,
so both sides of every comparison are guaranteed to be spelled
identically regardless of platform path-style quirks. No-op on
Linux/macOS, where the two forms already agree.

Verified on Windows 10 + Git Bash: 5 of 13 assertions failed before
this fix, all 13 pass after.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant