Skip to content

test(ci): cover Windows and Git Bash so #112 cannot regress - #114

Merged
timvw merged 2 commits into
mainfrom
ci/windows-git-bash-tests
Aug 10, 2026
Merged

test(ci): cover Windows and Git Bash so #112 cannot regress#114
timvw merged 2 commits into
mainfrom
ci/windows-git-bash-tests

Conversation

@timvw

@timvw timvw commented Aug 10, 2026

Copy link
Copy Markdown
Owner

The Git Bash bug in #112 shipped because nothing ran there: unit tests were Linux-only, and the Windows E2E legs only ran PowerShell and pwsh. Git Bash runs the same native wt.exe as PowerShell but through the bash integration — a combination no job covered.

CI coverage

  • Unit test job becomes a matrix: ubuntu-latest + windows-latest. No -race on the Windows leg (it needs a cgo toolchain, and the point is running the suite on a Windows host); coverage is still uploaded from Linux only.
  • New E2E leg: windows-latest × bash. e2e/run.go resolves bash from the Git for Windows install rather than PATH, so the WSL launcher in System32 is never picked up; exports MSYSTEM (a bash -c does not read /etc/profile); and translates paths with cygpath, since the interpreter only understands POSIX paths while wt.exe only understands native ones.

Regression scenarios

Windows-only (skip_os: [linux, darwin]), one per symptom of #112:

  • wt init --dry-run under Git Bash must emit eval "$(wt shellenv bash)" and not Invoke-Expression.
  • wt shellenv with no args must emit the bash wrapper, not PowerShell code.

The existing checkout_auto_cd_verified scenario now also runs on Git Bash, which is the literal symptom reported in the issue.

Unit tests

cmd/shellenv_wrapper_test.go executes the generated bash wrapper against a fake wt on PATH, covering:

  • the missing-script(1) fallback — auto-cd still works, redirected output is replayed, and the command's exit status survives rather than tee's;
  • cygpath translation of native Windows paths.

Both branches are driven from an ordinary bash by controlling what the wrapper's command -v probes find, so they run on every OS rather than only on Windows. Reverting either half of the #112 fix makes them fail.

Refs #112

The Git Bash bug in #112 shipped because nothing ran there: unit tests were
Linux-only, and the Windows E2E legs only ran PowerShell and pwsh. Git Bash
runs the same native wt.exe as PowerShell but through the bash integration —
a combination no job covered.

- Add a windows-latest leg to the unit test job (no -race there: it needs a
  cgo toolchain, and the point is running the suite on a Windows host).
- Add a windows/bash E2E leg. run.go resolves bash from the Git for Windows
  install rather than PATH, so the WSL launcher in System32 is never used,
  and translates paths with cygpath: the interpreter only understands POSIX
  paths, while wt.exe only understands native ones.
- Add E2E regression scenarios for the two symptoms of #112: init under Git
  Bash must configure bash rather than the PowerShell profile, and shellenv
  must emit the bash wrapper rather than PowerShell code.
- Add unit tests that execute the generated bash wrapper against a fake wt,
  covering the missing-script(1) fallback (auto-cd still works, output is
  replayed, the command's exit status survives rather than tee's) and the
  cygpath translation of native paths. Both branches are driven from an
  ordinary bash by controlling what the wrapper's probes find, so they run
  on every OS rather than only on Windows.

Refs #112
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 4.87805% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.91%. Comparing base (90726cb) to head (4bf8308).

Files with missing lines Patch % Lines
e2e/run.go 0.00% 39 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   32.22%   36.91%   +4.68%     
==========================================
  Files          27       27              
  Lines        3066     3102      +36     
==========================================
+ Hits          988     1145     +157     
+ Misses       1993     1871     -122     
- Partials       85       86       +1     
Files with missing lines Coverage Δ
cmd/worktree_path.go 58.53% <100.00%> (+0.25%) ⬆️
e2e/run.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Fallout from the new windows-latest unit test leg, which was the point of
adding it — three of these failures predate this branch and had simply never
run anywhere.

- findCaseInsensitivePathCollision gave up on the whole path when a component
  was absent from the directory listing under that exact spelling. On Windows
  an 8.3 short name (RUNNER~1 for runneradmin) is exactly that: valid, but
  reported by ReadDir only under its long name. Keep walking when the
  component resolves through Stat, or a collision below such a component goes
  unwarned.
- TestValidateShellEnvAcceptsValidXdgConfigHome built its "absolute" path as
  \abs\config, which on Windows is rooted but relative — it has no volume —
  so the test asserted the opposite of its name there.
- The bash wrapper tests compared the shell's idea of the working directory
  with Go's. Under Git Bash those are different spellings of the same
  directory (/tmp/... vs C:\Users\...\Temp\...), which no amount of
  EvalSymlinks reconciles. Identify the directory by a marker file instead,
  and convert paths through cygpath inside the harness so a native path in
  PATH is not split on its drive-letter colon.

Refs #112
@timvw
timvw enabled auto-merge (squash) August 10, 2026 11:52
@timvw
timvw merged commit 10dcef7 into main Aug 10, 2026
16 checks passed
@timvw
timvw deleted the ci/windows-git-bash-tests branch August 10, 2026 11:53
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